Listen to checkbox events:
var checkedArr=[]; table.on('checkbox(demo)', function(obj){if (obj.type=='all') 。
Enter code:
return;if (obj.checked){ checkedArr.push(obj.data.LAY_TABLE_INDEX); //checkedArr[obj.data.id] = obj.data.LAY_TABLEINDEX} else {delete checkedArr[obj.data.LAY_TABLE_INDE //delete checkedArr[obj.data.id。
Related recommendations: "layui framework tutorial"
Get the content of the selected row in the table and get the unique value needed for deletion, usually the id.
Add the item to be deleted to the array.
To determine whether it is selected, send an ajax request with the parameter id.
The above is the detailed content of How to clear layui table. For more information, please follow other related articles on the PHP Chinese website!