YUI - 数据表 - RadioCellEditor 问题
我正在使用 YUI 数据表。 myDataTable = new YAHOO.widget.DataTable("cellediting", myColumnDefs, myDataSource, { });
添加了 RadioCellEditor。 var radioEditor = new YAHOO.widget.RadioCellEditor({ radioOptions:["1","0"],disableBtns:true }); radioEditor.subscribe("saveEvent", saveChange);
saveChange是自定义函数,发送ajax请求并更新表中的数据。
一切正常。但是,如果单击单选单元选项,而不是选择提供的选项,单击 YUI 的其他一些区域,则 saveChange() 函数将调用 4 次。如何解决这个问题?
I am using YUI Datatable.
myDataTable = new YAHOO.widget.DataTable("cellediting", myColumnDefs, myDataSource, { });
Added RadioCellEditor.
var radioEditor = new YAHOO.widget.RadioCellEditor({ radioOptions:["1","0"],disableBtns:true });
radioEditor.subscribe("saveEvent", saveChange);
saveChange is customise function which send ajax request and update the data in the table.
Everything is working fine. But if click on radio cell option and instead of selecting provided option click some other areas of YUI then saveChange() function is calling 4 times. How to resolve this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果没有更多信息,我们无法确切知道问题是什么。然而,有一个更好的方法来做你想做的事。从 YUI 2.6 版本开始,您可以将 asyncSubmitter 选项与编辑器(包括 RadioCellEditor)一起使用。当单元格被编辑时调用,并且在提交的信息未成功提交到数据库的情况下具有更好的错误处理,即不会更新数据表。
本文提供了有关其工作原理的详细信息:http: //www.yuiblog.com/blog/2008/10/27/datatable-260-part-two/
Without more information we can't know exactly what the problem is. There is, however, a better way to do what you want. As of version 2.6 of YUI, you can use the asyncSubmitter option with an of the editors, including RadioCellEditor. This is called when a cell is edited and has better error handling in cases where the information submitted isn't successfully submitted to the database, i.e. won't update the datatable.
This article gives detailed information about how it works: http://www.yuiblog.com/blog/2008/10/27/datatable-260-part-two/