$(".saveData").click(() => {
let changeUrl =
"http://localhost:8090/iserver/services/data-World/rest/data/datasources/World/datasets/Countries";
let feature = selectResult.features[0];
console.log(feature);
let afterChangeData = getTableData();
console.log(afterChangeData);
let names = Object.keys(afterChangeData);
let values = Object.values(afterChangeData);
console.log(names);
console.log(values);
let outFeature = {
fieldNames: names,
fieldValues: values,
geometry: feature.geometry,
};
let editFeatureParameter = new SuperMap.REST.EditFeaturesParameters({
features: [outFeature],
editType: SuperMap.REST.EditType.UPDATE,
});
let editService = new SuperMap.REST.EditFeaturesService(changeUrl, {
eventListeners: {
processCompleted: editCompleted,
processFailed: editFailed,
},
});
editService.processAsync(editFeatureParameter);
// 处理编辑成功的回调函数
function editCompleted(editEventArgs) {
console.log("数据集编辑成功");
}
// 处理编辑失败的回调函数
function editFailed(editEventArgs) {
console.log(editEventArgs);
console.log("数据集编辑失败");
}
});
报错:errorMsg:"the number of 'fieldNames' and 'fieldValues' are not equal"
但是我在负载中查看的传入的这两个参数,他们的number相等呀
[
"SMID",
"SMUSERID",
"SMAREA",
"SMPERIMETER",
"SMGEOMETRY",
"COUNTRY",
"CAPITAL",
"COLORID",
"COLOR_MAP",
"SQKM",
"SQMI",
"POP_1994",
"CONTINENT"
]
{
"SMID": "234",
"SMUSERID": "0",
"SMAREA": "9.474653104403312E12",
"SMPERIMETER": "3.0389755757874787E7",
"SMGEOMETRY": "",
"COUNTRY": "中国",
"CAPITAL": "北京",
"COLORID": "1",
"COLOR_MAP": "1",
"SQKM": "9367281.0",
"SQMI": "3616707.25",
"POP_1994": "1.128139689E9",
"CONTINENT": "111"
}