Sunday, 15 August 2010

javascript - What is the most efficient way to update an array with objects without re-rendering the entire DOM in RactiveJS? -


If I have an array in the objects. {Id: 0, name: "Bob"}, {id: 1, name: "tim"}, {id: 2, name: "peat"},

];

And I want to update Tim to be "Tim Smith".

  tableAry [1] = {ID: 1, name: "Tim Smith"};  

How can I do this without resetting the entire array?

  ractive.set ("table", tableAry);  

Will not the whole table be forced to re-submit?

Set the target as a special keypath as possible:

  // A property ractive.set ("table.1.name", "Tim Smith"); // Multiple properties at once: ractive.set ({"table.1.name": "Tim Smith", "Table.1.Age": 12,}); // You can update the object var item = ractive.get ('table.1'); Item.name = 'Tim Smith'; Item.age = 22; Ractive.set ("table.1", item);  

It is being said, there are some similarities in reactive, which do not re-interpret the same value. However it still has to be compared to more comparison.


No comments:

Post a Comment