viewModel.getGridModel().on("beforeSetDataSource", function (data) { const index = data.findIndex((obj) => obj.year === "2024"); if (index !== -1) { data.splice(index, 1); } // console.log(data); });
viewModel.getGridModel().on("beforeSetDataSource", function (data) { // let data = [{total_amount: 1231231, id:23}, {total_amount: 123, id:11}, {id:231} ] // const index = data.findIndex((obj) => !obj.total_amount); // if (index !== -1) { // data.splice(index, 1); // } for (let i = data.length - 1; i >= 0; i--) { if (data[i].total_amount === undefined) { data.splice(i, 1); } } console.log(data); });
标签:index,obj,表格,amount,过滤,total,data,id,BIP From: https://www.cnblogs.com/LFxanla/p/18006662