1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "asStripeClasses" );
4 $(document).ready( function () {
5 /* Check the default */
6 $('#example').dataTable( {
8 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php"
12 "Default row striping is applied",
15 return $('#example tbody tr:eq(0)').hasClass('odd') &&
16 $('#example tbody tr:eq(1)').hasClass('even') &&
17 $('#example tbody tr:eq(2)').hasClass('odd') &&
18 $('#example tbody tr:eq(3)').hasClass('even');
23 "Row striping on the second page",
24 function () { $('#example_next').click(); },
26 return $('#example tbody tr:eq(0)').hasClass('odd') &&
27 $('#example tbody tr:eq(1)').hasClass('even') &&
28 $('#example tbody tr:eq(2)').hasClass('odd') &&
29 $('#example tbody tr:eq(3)').hasClass('even');
38 $('#example').dataTable( {
40 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
45 if ( typeof $('#example tbody tr:eq(1)')[0] == 'undefined' )
47 /* Use the 'wait for' to allow this to become true */
50 return $('#example tbody tr:eq(0)')[0].className == "" &&
51 $('#example tbody tr:eq(1)')[0].className == "" &&
52 $('#example tbody tr:eq(2)')[0].className == "" &&
53 $('#example tbody tr:eq(3)')[0].className == "";
59 "Custom striping [2]",
62 $('#example').dataTable( {
64 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
65 "asStripeClasses": [ 'test1', 'test2' ]
69 return $('#example tbody tr:eq(0)').hasClass('test1') &&
70 $('#example tbody tr:eq(1)').hasClass('test2') &&
71 $('#example tbody tr:eq(2)').hasClass('test1') &&
72 $('#example tbody tr:eq(3)').hasClass('test2');
77 /* long array of striping */
79 "Custom striping [4]",
82 $('#example').dataTable( {
84 "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
85 "asStripeClasses": [ 'test1', 'test2', 'test3', 'test4' ]
89 return $('#example tbody tr:eq(0)').hasClass('test1') &&
90 $('#example tbody tr:eq(1)').hasClass('test2') &&
91 $('#example tbody tr:eq(2)').hasClass('test3') &&
92 $('#example tbody tr:eq(3)').hasClass('test4');
97 "Custom striping is restarted on second page [2]",
98 function () { $('#example_next').click(); },
100 return $('#example tbody tr:eq(0)').hasClass('test1') &&
101 $('#example tbody tr:eq(1)').hasClass('test2') &&
102 $('#example tbody tr:eq(2)').hasClass('test3') &&
103 $('#example tbody tr:eq(3)').hasClass('test4');