1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-03 07:03:33 +02:00
8 1.11 Data types
koalyptus edited this page 2016-10-09 14:22:29 +11:00

Starting from v0.3.0, the following properties are no longer supported:

  • col_number_format
  • col_date_type
  • default_date_type

col_number_format and col_date_type are now merged in a single col_types option defining the data type of each column.

Property Type Description Remarks Example
locale string defines global locale (default - 'en')

Locales are now provided by the Sugar Date module, for more information refer to related documentation.

var tfConfig = { locale: 'en-GB'}
thousands_separator string defines default thousands separator, 2 possible values: '.' or ',' (default - ',') var tfConfig = { thousands_separator: "." }
decimal_separator string defines default decimal separator, 2 possible values: ',' or '.' (default - '.') var tfConfig = { decimal_separator: "," }
col_types array this array defines the data type on a column basis:
  • string (default column type if none specified)
  • number (unformatted number)
  • formatted-number (defaults to '.' decimal separator and ',' thousands separator) or
    or an object { type: 'formatted-number', decimal: ',', thousands: '.' } for customisation
  • date defaulting to en locale or
    or an object { type: 'date', locale: 'en-GB', format: ['{dd}-{months}-{yyyy|yy}'] } for customisation
  • ipaddress (specific to column sorting)
  • caseinsensitivestring (specific to column sorting)
  • none (specific to column sorting)

If you use the `sort` extension it is a good practice to use only the `col_types` option to define the column types for both filtering and sorting capabilities in one single configuration.

var tfConfig = { 
  col_types: [
    'string',
    'number',
    'formatted-number', // defaults to '.' for decimal and ',' for thousands
    { type: 'formatted-number', decimal: ',', thousands: '.' },
    'date', 
    { type: 'date', locale: 'fr' },
    { type: 'date', locale: 'en', format: ['{dd}-{months}-{yyyy|yy}'] }, 
    'ipaddress'
  ] 
};

Obsolete:

Property Type Description Remarks Example
default_date_type string defines default date type. It accepts the following values: 'DMY', 'MDY', 'YMD', 'DDMMMYYYY' (default - 'DMY')

Supported date types:

  • 31/12/1999, 31\12\1999, 31-12-1999, 31.12.1999
  • 31/12/99, 31\12\99, 31-12-99, 31.12.99
  • 12/31/1999, 12\31\1999, 12-31-1999, 12.31.1999
  • 12/31/99, 12\31\99, 12-31-99, 12.31.99
  • 1999/12/31, 1999\12\31, 1999-12-31, 1999.12.31
  • 31/Dec/1999, 31\Dec\1999, 31-Dec-1999, 31.Dec.1999
var tfConfig = { default_date_type: 'MDY'}
col_number_format array this array defines the number format by column, 3 possible values: 'EU', 'US' (decimal and thousands separator differences) and 'IPADDRESS'. The indexes of the array items match the indexes of the columns of the table ( [null,'EU','EU','IPADDRESS'] corresponds to col0, col1, col2, col3) (default - null) var tfConfig = { col_number_format: [null,'eu','eu', 'ipaddress'] }
col_date_type array this array defines the date format by column, 4 possible values: 'DMY', 'MDY', 'YMD', 'DDMMMYYYY' . The indexes of the array items match the indexes of the columns of the table ( [null,'DMY','YMD','DDMMMYYYY' ] corresponds to col0, col1, col2, col3) (default - null) var tfConfig = { col_date_type: [null,'DMY','YMD','DDMMMYYYY' ] }