This demo shows how to create a theme roller with the script's API.
var tfConfig = { filters_row_index: 2, headers_row_index: 1, sort: true, col_number_format: [null, null, 'US', null, null, null], col_date_type: [null, null, null, null, null, 'mdy'], rows_counter: true, rows_counter_text: 'Books: ', alternate_rows: true, btn_reset: true, mark_active_columns: true, selectable: true, /* Filter types*/ col_3: 'select', col_4: 'select', /* custom_cell_data callback used as delegate for filtering 'In store' column */ custom_cell_data_cols: [3], custom_cell_data: function(o, c, i){ if(i==3){ var chk = c.getElementsByTagName('input')[0]; if(!chk) return ''; if(chk.checked) return 'yes'; else return 'no'; } }, /* Custom options for 'Shipping' column */ custom_slc_options: { cols: [4], texts: [['1 Hour','12 Hours','24 Hours','2 Days','na']], values: [['1 Hour','12 Hours','24 Hours','2 Days','na']], sorts: [false] }, /* Basic theme */ themes: { name:['Basic'], src:['TableFilter/filtergrid.css'], description:['Basic stylesheet'], //callback used to initiliaze themes info initialize:[function(o){ tfConfig.initThemes(o); }] }, //Themes info initialization initThemes: function(o){ // Theme Paths o.ThemePaths = { Basic: 'TableFilter/filtergrid.css', Default: 'TableFilter/TF_Themes/Default/TF_Default.css', MyTheme: 'TableFilter/TF_Themes/MyTheme/MyTheme.css', SkyBlue: 'TableFilter/TF_Themes/SkyBlue/TF_SkyBlue.css' } // Theme roller function o.ChangeTheme = function(name){ var styleId = 'tfTheme'; var stylesheet = tf_Id(styleId); if(stylesheet == null){ //first time stylesheet is imported o.IncludeFile(styleId, o.ThemePaths[name], null, 'link'); } else { stylesheet.href = o.ThemePaths[name]; } } } } var tf = setFilterGrid("demo", tfConfig, 2);
Book | Price | Delivery Items | |||
---|---|---|---|---|---|
Title | Author | $ | In store | Shipping | Publication Date |
Boris Godunov | Alexandr Pushkin | 7.15 |
1 Hour | 01/01/1999 |
|
The Rainmaker | John Grisham | 7.99 |
2 Days | 12/01/2001 |
|
The Green Mile | Stephen King | 11.10 |
24 Hours | 01/01/1992 |
|
Misery | Stephen King | 7.70 |
na | 01/01/2003 |
|
The Dark Half | Stephen King | 0 |
2 Days | 10/30/1999 |
|
The Partner | John Grisham | 12.99 |
24 Hours | 01/01/2005 |
|
It | Stephen King | 9.70 |
12 Hours | 10/15/2001 |
|
Cousin Bette | Honore de Balzac | 0 |
1 Hour | 12/01/1991 |
|
The Testament | John Grisham | 19.10 |
2 Days | 12/17/1999 |
|
Eugene Onegin | Alexandr Pushkin | 11.20 |
24 Hours | 09/27/2005 |
|
Dark Avenues | Ivan Bunin | 14.96 |
1 Hour | 10/01/2008 |
|
Father Goriot | Honore de Balzac | 9.99 |
2 Days | 06/06/2010 |
|
The Captain's Daughter | Alexandr Pushkin | 10.21 |
2 Days | 03/01/2001 |
|
Hamlet | William Shakespeare | 5.99 |
1 Hour | 04/15/2003 |
|
The Village | Ivan Bunin | 11.66 |
24 Hours | 01/02/2010 |
|
The Winter's Tale | William Shakespeare | 19.31 |
1 Hour | 02/12/2010 |
|
The Black Sheep | Honore de Balzac | 16.00 |
1 Hour | 08/28/1976 |
|
Lost Illusions | Honore de Balzac | 8.0 |
na | 07/10/2010 |