Target column with class name not working as expected
Target column with class name not working as expected
I have a datatable working with an ASP.NET GridView perfectly. For some reason I have to define a specific column that include checkboxes. When I define it using the index it works fine but I need to make it more flexible with defining it using a class name where it actually work fine but generate error (mdata not defined) when delete all rows while not if this column defined using index.
This works fine:
"columnDefs": [
{ "targets": 0, "bSortable": true },
{ "targets": 2, "bSortable": true },
{ "targets": 3, "bSortable": true },
{ "targets": 5, "bSortable": true },
{ "targets": 8, "bSortable": false }, // checkboxes column
{ "targets": '_all', "bSortable": false }
],
This is not working the same:
"columnDefs": [
{ "targets": 0, "bSortable": true },
{ "targets": 2, "bSortable": true },
{ "targets": 3, "bSortable": true },
{ "targets": 5, "bSortable": true },
{ "targets": 'chkAll', "bSortable": false }, // checkboxes column
{ "targets": '_all', "bSortable": false }
],
I've also tried
"columnDefs": [
{ "targets": 0, "bSortable": true },
{ "targets": 2, "bSortable": true },
{ "targets": 3, "bSortable": true },
{ "targets": 5, "bSortable": true }
],
"aoColumnDefs": [
{
"bSortable": true,
"aTargets": [ -1 ] // checkboxes column
}
],
I also tried to not define that column since I do't need to but actually the error only disappear when defining it. Any idea why it's not effected when select all checkboxes and delete rows in second case?
Note: I use GridView, UpdatePanel and all works fine in all events.
Thank you,