1 // DATA_TEMPLATE: dom_data
2 oTest.fnStart( "asStripeClasses" );
4 $(document).ready( function () {
5 /* Check the default */
6 $('#example').dataTable();
9 "Default row striping is applied",
12 return $('#example tbody tr:eq(0)').hasClass('odd') &&
13 $('#example tbody tr:eq(1)').hasClass('even') &&
14 $('#example tbody tr:eq(2)').hasClass('odd') &&
15 $('#example tbody tr:eq(3)').hasClass('even');
20 "Row striping does not effect current classes",
23 return $('#example tbody tr:eq(0)').hasClass('gradeA') &&
24 $('#example tbody tr:eq(1)').hasClass('gradeA') &&
25 $('#example tbody tr:eq(2)').hasClass('gradeA') &&
26 $('#example tbody tr:eq(3)').hasClass('gradeA');
31 "Row striping on the second page",
32 function () { $('#example_next').click(); },
34 return $('#example tbody tr:eq(0)').hasClass('odd') &&
35 $('#example tbody tr:eq(1)').hasClass('even') &&
36 $('#example tbody tr:eq(2)').hasClass('odd') &&
37 $('#example tbody tr:eq(3)').hasClass('even');
46 $('#example').dataTable( {
51 return $('#example tbody tr:eq(0)')[0].className == "gradeA" &&
52 $('#example tbody tr:eq(1)')[0].className == "gradeA" &&
53 $('#example tbody tr:eq(2)')[0].className == "gradeA" &&
54 $('#example tbody tr:eq(3)')[0].className == "gradeA";
60 "Custom striping [2]",
63 $('#example').dataTable( {
64 "asStripeClasses": [ 'test1', 'test2' ]
68 return $('#example tbody tr:eq(0)').hasClass('test1') &&
69 $('#example tbody tr:eq(1)').hasClass('test2') &&
70 $('#example tbody tr:eq(2)').hasClass('test1') &&
71 $('#example tbody tr:eq(3)').hasClass('test2');
76 /* long array of striping */
78 "Custom striping [4]",
81 $('#example').dataTable( {
82 "asStripeClasses": [ 'test1', 'test2', 'test3', 'test4' ]
86 return $('#example tbody tr:eq(0)').hasClass('test1') &&
87 $('#example tbody tr:eq(1)').hasClass('test2') &&
88 $('#example tbody tr:eq(2)').hasClass('test3') &&
89 $('#example tbody tr:eq(3)').hasClass('test4');
94 "Custom striping is restarted on second page [2]",
95 function () { $('#example_next').click(); },
97 return $('#example tbody tr:eq(0)').hasClass('test1') &&
98 $('#example tbody tr:eq(1)').hasClass('test2') &&
99 $('#example tbody tr:eq(2)').hasClass('test3') &&
100 $('#example tbody tr:eq(3)').hasClass('test4');