A json array that deletes the specified object through splice, and the final returned array length is the original length, but the original data is replaced by []. The
code is as follows:
table.on ("tool (sampleList)", function (obj) {
var data = obj.data;
if (obj.event === "del") {
layer.confirm("" + "<span style="color:red;">" + data.name + "</span>" + "", function (index) {
obj.del();
for(var i=0;i<infoList.length;iPP){
if(infoList[i].name==data.name){
infoList.splice(i,1);
}
}
$("-sharpinstrumentPurchaseInfoList").val(JSON.stringify(infoList));
layer.close(index);
});
}
})
:
:
[{"page":1,"limit":10,"displayStart":0,"flag":0,"userId":null,"userType":0,"id":14,"purchaseId":5,"name":"111","specification":"","unit":"","price":null,"num":null,"generatingUnit":"","LAY_TABLE_INDEX":0},{"page":1,"limit":10,"displayStart":0,"flag":0,"userId":null,"userType":0,"id":15,"purchaseId":5,"name":"sjh","specification":"","unit":"","price":null,"num":null,"generatingUnit":"","LAY_TABLE_INDEX":1},{"page":1,"limit":10,"displayStart":0,"flag":0,"userId":null,"userType":0,"id":16,"purchaseId":5,"name":"222","specification":"","unit":"","price":null,"num":null,"generatingUnit":"","LAY_TABLE_INDEX":2},{"page":1,"limit":10,"displayStart":0,"flag":0,"userId":null,"userType":0,"id":17,"purchaseId":5,"name":"333","specification":"","unit":"","price":null,"num":null,"generatingUnit":"","LAY_TABLE_INDEX":3}]
:
data are as follows:
{[], []}