if(sportsScores [i] .playerName ===“jump Data(here)”){
let sportsScores = values.data;
for (let i = 0; i < sportsScores.length; i++) {
//console.log(sportsScores[i].ballName + "<---sportsScores[i].ballName--->" + sportsScores[i].playerName);
if(sportsScores[i].playerName === "jump Data (here)") {
console.log("sportsScores[i].playerName.splice(i, 1);--->");
//sportsScores[i].playerName.splice(i, 1);
//sportsScores.splice(sportsScores[i].playerName,1)
//sportsScores.splice(sportsScores[i].playerName);
sportsScores.splice(sportsScores[118]);
//console.log("sportsScores.splice(sportsScores[118]);--->" , sportsScores.splice(sportsScores[118]));
//console.log("sportsScores[i].playerName.splice(i, 1);--->" , sportsScores.splice(sportsScores[i].playerName,1));
//console.log("sportsScores[i].playerName.splice(i, 1);--->" , sportsScores.splice(sportsScores[i].playerName));
//console.log("sportsScores[i].playerName.delete(i, 1);--->" , sportsScores.delete(sportsScores[i].playerName,1));
}
sportsScores[i]["ballNameFilterRowId"] = sportsScores[i].ballName;
sportsScores[i]["playerNameFilterRowId"] = sportsScores[i].playerName;
sportsScores[i]["playerTypeFilterRowId"] = sportsScores[i].playerType;
}
this.gridkendo.reloadDataSource(values.data);
**JSON structure**
(312) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, …]
[0 … 99]
[100 … 199]
[200 … 299]
[300 … 311]
0
:
{playerID: 301, playerName: "Administration", playerType: "ball", playerTypeOrder: 1, ballID: 28, …}
1
:
{playerID: 302, playerName: "Special Events", playerType: "Node", playerTypeOrder: 2, ballID: 28, …}
2
:
{playerID: 304, playerName: "Off the Clock Settings", playerType: "Node", playerTypeOrder: 2, ballID: 28, …}
0:
playerID : 301
playerName : "Administration"
playerNameFilterRowId : "Administration"
playerType : "ball"
playerTypeOrder : 1
ballID : 28
ballName : "Admin"
ballNameFilterRowId : "Admin"
permissionLevelTypeID : 1
permissions : null
__proto__ : Object
你正在以不同的方式做到这一点,删除元素的最好方法是找到索引,然后将其拼接1.试试这个
Var index = sportsScores.indexOf(function(obj){return obj.playerName ==“your condition”});
通过此,您将能够获取索引以删除项目,而无需循环。
要删除项目只需拼接它。
sportsScore.splice(指数,1);
这里的最后一个参数1是要从索引中删除的元素。