1 // DATA_TEMPLATE: js_data
2 oTest.fnStart( "asStripeClasses" );
4 $(document).ready( function () {
5 /* Check the default */
6 $('#example').dataTable( {
11 "Default row striping is applied",
14 return $('#example tbody tr:eq(0)').hasClass('odd') &&
15 $('#example tbody tr:eq(1)').hasClass('even') &&
16 $('#example tbody tr:eq(2)').hasClass('odd') &&
17 $('#example tbody tr:eq(3)').hasClass('even');
22 "Row striping on the second page",
23 function () { $('#example_next').click(); },
25 return $('#example tbody tr:eq(0)').hasClass('odd') &&
26 $('#example tbody tr:eq(1)').hasClass('even') &&
27 $('#example tbody tr:eq(2)').hasClass('odd') &&
28 $('#example tbody tr:eq(3)').hasClass('even');
37 $('#example').dataTable( {
43 return $('#example tbody tr:eq(0)')[0].className == "" &&
44 $('#example tbody tr:eq(1)')[0].className == "" &&
45 $('#example tbody tr:eq(2)')[0].className == "" &&
46 $('#example tbody tr:eq(3)')[0].className == "";
52 "Custom striping [2]",
55 $('#example').dataTable( {
57 "asStripeClasses": [ 'test1', 'test2' ]
61 return $('#example tbody tr:eq(0)').hasClass('test1') &&
62 $('#example tbody tr:eq(1)').hasClass('test2') &&
63 $('#example tbody tr:eq(2)').hasClass('test1') &&
64 $('#example tbody tr:eq(3)').hasClass('test2');
69 /* long array of striping */
71 "Custom striping [4]",
74 $('#example').dataTable( {
76 "asStripeClasses": [ 'test1', 'test2', 'test3', 'test4' ]
80 return $('#example tbody tr:eq(0)').hasClass('test1') &&
81 $('#example tbody tr:eq(1)').hasClass('test2') &&
82 $('#example tbody tr:eq(2)').hasClass('test3') &&
83 $('#example tbody tr:eq(3)').hasClass('test4');
88 "Custom striping is restarted on second page [2]",
89 function () { $('#example_next').click(); },
91 return $('#example tbody tr:eq(0)').hasClass('test1') &&
92 $('#example tbody tr:eq(1)').hasClass('test2') &&
93 $('#example tbody tr:eq(2)').hasClass('test3') &&
94 $('#example tbody tr:eq(3)').hasClass('test4');