问题描述
我正在尝试从我的列表中选择所有客户,以使用cql过滤器输入功能在地图上显示。
问题在于,当cql过滤器获取下一个500时,我将在500亿之后异步选择500个客户,这会从地图中删除前500个。
我该怎么做,那个cql过滤器不会删除前500个并显示下500个?
let points = [];
$("#selectAllCustomers").on("change",async function () {
if (this.checked) {
dataload.classList.remove("loading-finish");
setTimeout(async () => {
let checkedProducts = $("input[name='productInput']:checked");
let checkedProductsIds = [];
checkedProducts.each(function () {
let ids = $(this).attr("id");
checkedProductsIds.push(ids);
});
let customerCheckedIds = [];
let customercheckBoxlength = $(
"input[name='customer-input']:visible"
).not(":checked");
if (customercheckBoxlength.length > 0) {
for (let i = 0; i < customercheckBoxlength.length; i++) {
let ch = customercheckBoxlength[i];
let chid = customercheckBoxlength[i].id;
ch.checked = true;
customerCheckedIds.push(chid.slice(4));
let point = chid.slice(4); points.push(parseInt(point));
if (i == 499) {
break;
}
}
// console.log(customerCheckedIds,checkedProductsIds);
wmsPoint.setVisible(true);
//pointsLayer.updateParams({ CQL_FILTER: null });
pointsLayer.updateParams({ CQL_FILTER: `idShop in ${points}`,});
if (customercheckBoxlength.length > 0) {
$(this).prop("checked",true).trigger("change");
}
} else {
dataload.classList.add("loading-finish");
}
},3000);
} else {
points = [];
wmsPoint.setVisible(false);
pointsLayer.updateParams({
CQL_FILTER: `idShop in ${points}`,});
$("input[name='customer-input']:visible").each(function () {
this.checked = false;
// $(this).trigger("change");
});
}
});
如您所见,这些点是我存储客户商店的每500 id的数组。
在每个循环上,将500个id添加到points数组,但是当点数组具有1000或1500 id时,它不起作用,则会出现cors错误。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)