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

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

问题描述

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

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.

首先,我将此函数添加到 DataGriditemEditEnd 事件中,但该函数在新值更新到 dataProvider 之前被调用code> 因此,我在函数中的值是旧值.将值更新到 dataProvider 后是否会触发任何其他事件?还是我遗漏了什么?

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?

其次,我尝试将这个函数放在每个 itemEditor 的更改事件中(废话!),但又一次,更改事件被触发,但是 dataProvider是旧的.

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.

有什么方法可以让函数 updateValues() 被调用,每次编辑一个值并将其更新到 dataProvider 中时,因为我在那里值来自?

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?

非常感谢.

推荐答案

"在您的事件侦听器中,您可以检查输入到项目编辑器中的数据.如果数据不正确,您可以调用 preventDefault() 方法来阻止 Flex 将新数据传递回基于列表的控件并从关闭编辑器."(来源)

是的,它在数据提供者获得数据之前被调用.

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

您应该阅读以下内容:检测数据网格编辑.他谈论所有相同的东西.事件优先权是门票.过于复杂的是 Flex 方式.干杯.

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天全站免登陆