Ability to update list without reloading it when editing a row using knockoutjs

时光总嘲笑我的痴心妄想 提交于 2019-12-11 07:03:52

问题


I have this code: http://jsfiddle.net/nickbuus/82q8j/11/

When I press edit on the "row" and then update I am updating the data on the server and then reloading all of the rows using:

 GetFoods('catname');

I am using knockoutjs - is there a clever way to connect and update the particular row in the list that was edited without having to reload all of the rows on update?


回答1:


On the ApiController, you should add three new methods

  • Create a new item
  • Update existing item
  • Get info of a specific item

With these methods you will be able to do what you are looking for. I also suggest you to have a look at knockout.mapping and more specifically at the ko.mapping.fromJS and toJS functions.



来源:https://stackoverflow.com/questions/16999035/ability-to-update-list-without-reloading-it-when-editing-a-row-using-knockoutjs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!