使用淘汰表编辑行时能够更新列表而无需重新加载列表 [英] Ability to update list without reloading it when editing a row using knockoutjs

查看:76
本文介绍了使用淘汰表编辑行时能够更新列表而无需重新加载列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码: http://jsfiddle.net/nickbuus/82q8j/11/

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?

推荐答案

在ApiController上,您应该添加三个新方法

On the ApiController, you should add three new methods

  • 创建新项目
  • 更新现有项目
  • 获取特定商品的信息

使用这些方法,您将能够完成所需的操作. 我还建议您查看 knockout.mapping ,尤其是在ko. mapping.fromJS和toJS函数.

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.

这篇关于使用淘汰表编辑行时能够更新列表而无需重新加载列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆