1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "asStripeClasses" );
4 $(document).ready( function () {
5 /* Check the default */
6 $('#example').dataTable( {
7 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
10 { "mData": "browser" },
11 { "mData": "platform" },
12 { "mData": "version" },
18 "Default row striping is applied",
21 return $('#example tbody tr:eq(0)').hasClass('odd') &&
22 $('#example tbody tr:eq(1)').hasClass('even') &&
23 $('#example tbody tr:eq(2)').hasClass('odd') &&
24 $('#example tbody tr:eq(3)').hasClass('even');
29 "Row striping on the second page",
30 function () { $('#example_next').click(); },
32 return $('#example tbody tr:eq(0)').hasClass('odd') &&
33 $('#example tbody tr:eq(1)').hasClass('even') &&
34 $('#example tbody tr:eq(2)').hasClass('odd') &&
35 $('#example tbody tr:eq(3)').hasClass('even');
44 $('#example').dataTable( {
45 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
47 { "mData": "engine", "aTargets": [0] },
48 { "mData": "browser", "aTargets": [1] },
49 { "mData": "platform", "aTargets": [2] },
50 { "mData": "version", "aTargets": [3] },
51 { "mData": "grade", "aTargets": [4] }
57 if ( typeof $('#example tbody tr:eq(1)')[0] == 'undefined' )
59 /* Use the 'wait for' to allow this to become true */
62 return $('#example tbody tr:eq(0)')[0].className == "" &&
63 $('#example tbody tr:eq(1)')[0].className == "" &&
64 $('#example tbody tr:eq(2)')[0].className == "" &&
65 $('#example tbody tr:eq(3)')[0].className == "";
71 "Custom striping [2]",
74 $('#example').dataTable( {
75 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
77 { "mData": "engine", "aTargets": [0] },
78 { "mData": "browser", "aTargets": [1] },
79 { "mData": "platform", "aTargets": [2] },
80 { "mData": "version", "aTargets": [3] },
81 { "mData": "grade", "aTargets": [4] }
83 "asStripeClasses": [ 'test1', 'test2' ]
87 return $('#example tbody tr:eq(0)').hasClass('test1') &&
88 $('#example tbody tr:eq(1)').hasClass('test2') &&
89 $('#example tbody tr:eq(2)').hasClass('test1') &&
90 $('#example tbody tr:eq(3)').hasClass('test2');
95 /* long array of striping */
97 "Custom striping [4]",
100 $('#example').dataTable( {
101 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
103 { "mData": "engine", "aTargets": [0] },
104 { "mData": "browser", "aTargets": [1] },
105 { "mData": "platform", "aTargets": [2] },
106 { "mData": "version", "aTargets": [3] },
107 { "mData": "grade", "aTargets": [4] }
109 "asStripeClasses": [ 'test1', 'test2', 'test3', 'test4' ]
113 return $('#example tbody tr:eq(0)').hasClass('test1') &&
114 $('#example tbody tr:eq(1)').hasClass('test2') &&
115 $('#example tbody tr:eq(2)').hasClass('test3') &&
116 $('#example tbody tr:eq(3)').hasClass('test4');
121 "Custom striping is restarted on second page [2]",
122 function () { $('#example_next').click(); },
124 return $('#example tbody tr:eq(0)').hasClass('test1') &&
125 $('#example tbody tr:eq(1)').hasClass('test2') &&
126 $('#example tbody tr:eq(2)').hasClass('test3') &&
127 $('#example tbody tr:eq(3)').hasClass('test4');