Instead of passing the value like {'bSortable': false},null,null,null,null,null,null,null,null,null,null,null,null,null,{'bSortable': false}
in aoColumns
can I pass a string which is also containing the same value as above in datatables and php? My Code is like:
而不是像{'bSortable':false}那样传递值,null,null,null,null,null,null,null,null,null,null,null,null,null,{'bSortable':false}在aoColumns中可以我传递一个字符串,它在datatables和php中也包含与上面相同的值?我的代码就像:
var excluded_clmns_sorting = $('#sorting_val').val();
//the above variable returns {'bSortable': false},null,null,null,null,null,null,null,null,null,null,null,null,null,{'bSortable': false}.
var oTable = $('#data-table').dataTable( {
"sDom": 'CT<"clear">firtlip',
"oTableTools": {
"sSwfPath": basePath+"/js/extras/TableTools/media/swf/copy_csv_xls_pdf.swf",
"aButtons": [ {"sExtends": "csv","sFileName" : curpath+".csv","sButtonText": "Save to CSV","mColumns": "visible"} ]
},
"aoColumns" : [excluded_clmns_sorting]
} );
In js Console it is showing nCell is undefined
. Please help me. Thanks in advance.
在js控制台中,它显示nCell未定义。请帮我。提前致谢。
//UPDATE if I pass array in excluded_clmns_sorting
variable and doing the following code:
//如果我在excluded_clmns_sorting变量中传递数组并执行以下代码,则更新:
var excluded_clmns_sorting = $('#sorting_val').val();
var excluded_clmn_sorting = (excluded_clmns_sorting) ? excluded_clmns_sorting.split(",") : [];
$.each(excluded_clmn_sorting, function (i) {
excluded_clmn_sorting[i] = (excluded_clmn_sorting[i]);
})
var oTable = $('#data-table').dataTable( {
"sDom": 'CT<"clear">firtlip',
"oTableTools": {
"sSwfPath": basePath+"/js/extras/TableTools/media/swf/copy_csv_xls_pdf.swf",
"aButtons": [ {"sExtends": "csv","sFileName" : curpath+".csv","sButtonText": "Save to CSV","mColumns": "visible"} ]
},
"aoColumns" : [excluded_clmn_sorting],
"aoColumnDefs": [{
"bVisible": false,
"aTargets" : excluded_clmn
},
],
"iDisplayLength": 10,
'sPaginationType': 'full_numbers'
} );
Then in js Console it is showing only oCol is undefined
.
然后在js控制台中显示只有oCol未定义。
1 个解决方案
#1
0
you can put a array
in aoCoumns
not string
你可以把数组放在aoCoumns而不是字符串中
aoColumns
: If specified, then the length of this array
must be equal to the number of columns
in the original HTML table. Use 'null' where you wish to use only the default values and automatically detected options.
aoColumns:如果指定,则此数组的长度必须等于原始HTML表中的列数。如果您希望仅使用默认值和自动检测到的选项,请使用“null”。
Hope it will help you
希望它会对你有所帮助
#1
0
you can put a array
in aoCoumns
not string
你可以把数组放在aoCoumns而不是字符串中
aoColumns
: If specified, then the length of this array
must be equal to the number of columns
in the original HTML table. Use 'null' where you wish to use only the default values and automatically detected options.
aoColumns:如果指定,则此数组的长度必须等于原始HTML表中的列数。如果您希望仅使用默认值和自动检测到的选项,请使用“null”。
Hope it will help you
希望它会对你有所帮助