1 |
// DATA_TEMPLATE: empty_table |
2 |
oTest.fnStart( "5396 - fnUpdate with 2D arrays for a single row" ); |
3 |
|
4 |
$(document).ready( function () { |
5 |
$('#example thead tr').append( '<th>6</th>' ); |
6 |
$('#example thead tr').append( '<th>7</th>' ); |
7 |
$('#example thead tr').append( '<th>8</th>' ); |
8 |
$('#example thead tr').append( '<th>9</th>' ); |
9 |
$('#example thead tr').append( '<th>10</th>' ); |
10 |
|
11 |
var aDataSet = [ |
12 |
[ |
13 |
"1", |
14 |
"홍길동", |
15 |
"1154315", |
16 |
"etc1", |
17 |
[ |
18 |
[ "test1@daum.net", "2011-03-04" ], |
19 |
[ "test1@naver.com", "2009-07-06" ], |
20 |
[ "test4@naver.com", ",hide" ], |
21 |
[ "test5?@naver.com", "" ] |
22 |
], |
23 |
"2011-03-04", |
24 |
"show" |
25 |
], |
26 |
[ |
27 |
"2", |
28 |
"홍길순", |
29 |
"2154315", |
30 |
"etc2", |
31 |
[ |
32 |
[ "test2@daum.net", "2009-09-26" ], |
33 |
[ "test2@naver.com", "2009-05-21,hide" ], |
34 |
[ "lsb@naver.com", "2010-03-05" ], |
35 |
[ "lsb3@naver.com", ",hide" ], |
36 |
[ "sooboklee9@daum.net", "2010-03-05" ] |
37 |
], |
38 |
"2010-03-05", |
39 |
"show" |
40 |
] |
41 |
] |
42 |
|
43 |
var oTable = $('#example').dataTable({ |
44 |
"aaData": aDataSet, |
45 |
"aoColumns": [ |
46 |
{ "mData": "0"}, |
47 |
{ "mData": "1"}, |
48 |
{ "mData": "2"}, |
49 |
{ "mData": "3"}, |
50 |
{ "mData": "4.0.0"}, |
51 |
{ "mData": "4.0.1"}, |
52 |
{ "mData": "4.1.0"}, |
53 |
{ "mData": "4.1.1"}, |
54 |
{ "mData": "5"}, |
55 |
{ "mData": "6"} |
56 |
] |
57 |
}); |
58 |
|
59 |
|
60 |
oTest.fnTest( |
61 |
"Initialisation", |
62 |
null, |
63 |
function () { |
64 |
return $('#example tbody tr:eq(0) td:eq(0)').html() == '1'; |
65 |
} |
66 |
); |
67 |
|
68 |
oTest.fnTest( |
69 |
"Update row", |
70 |
function () { |
71 |
$('#example').dataTable().fnUpdate( [ |
72 |
"0", |
73 |
"홍길순", |
74 |
"2154315", |
75 |
"etc2", |
76 |
[ |
77 |
[ "test2@daum.net", "2009-09-26" ], |
78 |
[ "test2@naver.com", "2009-05-21,hide" ], |
79 |
[ "lsb@naver.com", "2010-03-05" ], |
80 |
[ "lsb3@naver.com", ",hide" ], |
81 |
[ "sooboklee9@daum.net", "2010-03-05" ] |
82 |
], |
83 |
"2010-03-05", |
84 |
"show" |
85 |
], 1 ); |
86 |
}, |
87 |
function () { |
88 |
return $('#example tbody tr:eq(0) td:eq(0)').html() == '0'; |
89 |
} |
90 |
); |
91 |
|
92 |
oTest.fnTest( |
93 |
"Original row preserved", |
94 |
null, |
95 |
function () { |
96 |
return $('#example tbody tr:eq(1) td:eq(0)').html() == '1'; |
97 |
} |
98 |
); |
99 |
|
100 |
|
101 |
|
102 |
oTest.fnComplete(); |
103 |
} ); |