在itemEditEnd事件之前从itemEditor提交新的值 [英] Commit new value from itemEditor before itemEditEnd event

查看:217
本文介绍了在itemEditEnd事件之前从itemEditor提交新的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个DataGrid,在几列中有 itemEditor 作为 NumericStepper 。当DataGrid中的值被编辑时,我想更新屏幕上显示的几个值,所以要调用 updateValues()函数。 b
$ b

首先,我将这个函数添加到 DataGrid itemEditEnd 事件中,但是该函数在新值更新到 dataProvider 之前被调用,因此函数中的值是旧值。在值更新到 dataProvider 之后是否还有其他事件被触发?第二,我试着把这个函数放在每个 itemEditor (duh !),但是再次,更改事件被触发,但是 dataProvider 中的值是旧的。



<有什么办法可以调用函数 updateValues(),每次编辑值并更新到 dataProvider ,因为我从哪里取值?



非常感谢。

解决方案


在您的事件监听器中,您可以检查输入到项目编辑器中的数据从传递新的数据到基于列表的控制以及关闭编辑器。 (来源


所以是的,它会在数据提供者获得数据之前调用。



这是你应该阅读的:检测Datagrid编辑。他谈到所有相同的东西。事件优先级是票证。 Flex方式太复杂了。干杯。

I have a DataGrid, with itemEditor as NumericStepper in a few columns. When a value in the DataGrid is edited, I would like to update several values displayed on the screen, and so want to call a updateValues() function.

First, I added this function to itemEditEnd event of the DataGrid, but the function is getting called before the new value is updated into the dataProvider and hence, the values I have in the function are the old values. Is there any other event that is fired after the values are updated into the dataProvider? or am I missing something?

Second, I tried putting this function in the change event of each itemEditor (duh!), but then again, the change event is fired, but the values in the dataProvider are the old ones.

Is there any way I can make the function updateValues() be called, every time a value is edited AND updated into the dataProvider, because there's where I am taking the values from?

Thanks a lot.

解决方案

"In your event listener, you can examine the data entered into the item editor. If the data is incorrect, you can call the preventDefault() method to stop Flex from passing the new data back to the list-based control and from closing the editor." (source)

So yeah, it gets called before the dataprovider has the data.

Here's what you should read: Detecting Datagrid Edits. He talks about all the same stuff. Event priority is the ticket. Overly complicated is the Flex way. Cheers.

这篇关于在itemEditEnd事件之前从itemEditor提交新的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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