Tuesday, 15 July 2014

javascript - remove specific id from array of checked items -


I have a list of games / arrays, which by default all checked = true In this function, you can see this line intersectedSports = _.intersection (sportIds, sportChecked.sport); where sportIds is a complete list of game IDs and

Remember: all the games are check = true / code> By default.

This is an array of 30 items, each item has a unique id , as I have stated that all the games are checked = true , But I need to have id: 10 by default in the check = wrong .

On the back of this code, you see that the user who already created an item in a DB is check = wrong , so you can see this line here game.checked =! _. (IntersectedSports, sport) ID; .

Therefore, to do what I want, my guess: I have to put id: 10 to check = false in Var = intersectedSports which I have described above, unless you have a better suggestion for me ... So, what do you recommend to your friends?

  Miscellaneous gameIDs = _.plak (game, 'id'), intersectionports = _ indian (sport id, sports checked .support); If (game.line) {game = _.map (play, function (game) {game.checked =! _ Contains (pseudo support, sport.id); return game;}); }  

In the case of a bus: I am using Lodash and Konal

You can simplify the logic like this:

  // Create a list of games that should be unchecked var uncheck = gamecacked .port .concat (10); // Add a checked property to each game _.each (game, function (game) {sport.checked =! _. (Uncontrolled, sport.id);});  

No comments:

Post a Comment