Hello everyone!
The idea is that I want to use autodetectable sorting on my datatables which work good, but in cases where I have textboxes, checkbox or other, I use sSortDataType, and it seems to work also! But! I'm having some problems with aoColumns when using an array, dynamically defined on every subsite. When I go into a subsite I start with defining the columns attached like this:
A console.log of "aoColumn" gives for example:
{ "sSortDataType": "dom-text" }, null, null, null, { "sSortDataType": "dom-text" }, null
I want to do it like this, by insert the array to aoColumns, but it doesn't work!:
but if I hardcode my array from one subsite into the aoColumns like this it works!!!;
It works very nicely even if I write new text into textbox, they are sorted good. But only in the hardcoded example. How can I get my dynamic array to work? Any idea? If you need more code or explaination, please tell me.
Thanks,
Ole
The idea is that I want to use autodetectable sorting on my datatables which work good, but in cases where I have textboxes, checkbox or other, I use sSortDataType, and it seems to work also! But! I'm having some problems with aoColumns when using an array, dynamically defined on every subsite. When I go into a subsite I start with defining the columns attached like this:
ths.each( function( index ) { th = $(this); if( th.attr('sorting') ) { var column = '{ "sSortDataType": "' + th.attr('sorting') + '" }'; } else { var column = "null"; } aoColumn.push(column); }dom-text is then defined in the header of where I have textboxes columns. All "null" are handled with auto-type detection.
A console.log of "aoColumn" gives for example:
{ "sSortDataType": "dom-text" }, null, null, null, { "sSortDataType": "dom-text" }, null
I want to do it like this, by insert the array to aoColumns, but it doesn't work!:
var options = { "aLengthMenu": [[10, 50, 100, -1], [10, 50, 100, "All"]], "aoColumns": aoColumn, .... };
but if I hardcode my array from one subsite into the aoColumns like this it works!!!;
var options = { "aLengthMenu": [[10, 50, 100, -1], [10, 50, 100, "All"]], "aoColumns": [ { "sSortDataType": "dom-text" }, null, null, null, { "sSortDataType": "dom-text" }, null ], .... };
It works very nicely even if I write new text into textbox, they are sorted good. But only in the hardcoded example. How can I get my dynamic array to work? Any idea? If you need more code or explaination, please tell me.
Thanks,
Ole