1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
describe( 'columns.data option', function() {
dt.libs( {
js: [ 'jquery', 'datatables' ],
css: [ 'datatables' ]
} );
dt.html( 'empty' );
it( 'Data can be loaded using an escaped dot', function () {
$.fn.dataTable.ext.errMode = 'throw';
table = $('#example').DataTable( {
data: [ {
'1.0': 1,
'1.1': 2,
'1.2': 3,
'1.3': 4,
'1.4': 5,
'1.5': 6
} ],
columns: [
{ data: '1\\.0' },
{ data: '1\\.1' },
{ data: '1\\.2' },
{ data: '1\\.3' },
{ data: '1\\.4' },
{ data: '1\\.5' }
]
} );
expect( table.cell( 0, 0 ).data() ).toBe( 1 );
} );
// DataTables/DataTables #869
dt.html( 'empty' );
it( 'An escaped backslash can be used with an escaped dot as a data accessor', function () {
table = $('#example').DataTable( {
data: [ {
'1\\x.0': 7,
'1\\x.1': 8,
'1\\x.2': 9,
'1\\x.3': 10,
'1\\x.4': 11,
'1\\x.5': 12
} ],
columns: [
{ data: '1\\x\\.0' },
{ data: '1\\x\\.1' },
{ data: '1\\x\\.2' },
{ data: '1\\x\\.3' },
{ data: '1\\x\\.4' },
{ data: '1\\x\\.5' }
]
} );
expect( table.cell( 0, 0 ).data() ).toBe( 7 );
} );
} );
|