Hi All:
In a datatable with a column of checkboxes, how can I collect all the checked checkboxes and assign a function such as deleting or updating values (via AJAX request).
Thank you
Hi All:
In a datatable with a column of checkboxes, how can I collect all the checked checkboxes and assign a function such as deleting or updating values (via AJAX request).
Thank you
I can do the AJAX request part myself, so how about a function that just alerts me all the rows (ie. row id) with a checked checkbox.
Thank you
you can use eachRow ( http://docs.webix.com/api__ui.datatable_eachrow.html ) to iterate through all rows and collect ids of checked ones
var data = [];
grid.eachRow(function(obj){
if (obj.status) data.push(obj.id); //assuming that id of checkbox column is "status"
});
The issue here is if I have 1000 rows, and only first 2 are checked … it will still take up lookup time for the remaining 998.
Would you have any suggestions?
Is there a function that stores the obj.id into an array or list, then process that list/array?
So if a checkbox is checked, it is loaded into list/array, as soon as it is unchecked, it is removed from the list.
The reason why I ask is that I finding a scoping issue where trying this inside on: onCheck(function {}… code.
This grid.eachRow(function(obj) … works well with select all checkbox.
This API doesn’t work with real DOM so it is very fast.
The difference between looping from 2 rows and 2000 rows will be less than 1 millisecond.
great … good to know