Meaning . . . I've seen cases where I've bound components to a [Bindable] dataProvider. When I updated the data in the dataProvider, the component doesn't reflect the change immediately. Do I need to do something to refresh the data? What event causes a component to refresh its dataProvider data?
相关问题
- How do I filter out secific nodes of XML?
- Flex getApplicationVersion() always returns null v
- change color row in datagrid
- What overhead is there of using an MXML file in Fl
- flex 3 passing data from modules to parent applica
相关文章
- 可以Maven项目有多个父?(Can maven projects have multiple pa
- 排序Flex中一个ArrayCollection(Sorting an ArrayCollectio
- 滚动到选择的项目在Flex 4中Spark List组件(Scroll to selected it
- 任何Flex 4迁移体验?(Any Flex 4 migration experience?)
- 软硬度:错误#2038:文件I / O错误[关闭](Flex: Error #2038: File
- 它是可行的使用Flex创建REST客户端?(Is it feasible to create a R
- AS3:导出一个MovieClip或画布SWF(AS3: Export a MovieClip or
- 如何工作的自定义MXML组件registerClassAlias()方法(how to work r
that would depend on what you did to the data. did you apply a filter, if so you'll need to refresh the data. did you do a sort, if so you'll need to refresh the data. Is your dataProvider an Array, if so this doesn't do binding, use an ArrayCollection.
Give us an example of what it is that isn't updating and we should be able to give specifc help.
This is probably overkill, but if you are really interested in what happens under the hood when you add the [Bindable] tag, I strongly recommend checking out Michael Labriola's Diving in the Data Binding Waters session from 360|Flex!San Jose. It is by far the most in-depth presentation on this subject that you will find.
To view it you'll need to download Adobe Media Player (which runs on Adobe Air). If you have problems subscribing to the 360|Flex sessions in the Adobe Media Player, follow Ted Patrick's advice from his blog post.
His presentation is also on Slideshare, but it's nowhere near as informative or entertaining.
Chapter 7 of the developer's guide deals exactly with this. I suggest you read it.
Excerpt:
See also this about data binding and arrays
"When a property is the source of a data binding expression, Flex automatically copies the value of the source property to any destination property when the source property changes. To signal to Flex to perform the copy, you must use the [Bindable] metadata tag to register the property with Flex, and the source property must dispatch an event."
If you're into fiddling around with the command line compiler, you can use the
compile.keep-generated-actionscript
flag to see the effect of adding[Bindable]
to a property. Create a simple actionscript class called test and add a single bindable string property to it then compile it like this :mxmlc -compiler.keep-generated-actionscript test.as
This will create a folder called "generated" containing all the extra action script, which in this case would be a single file called (probably) "_test-binding-generated.as".
You should be able to see from this that adding the bindable tag just creates a wrapper which implements IEventDispatcher and dispatches an event when the setter is called. It's this wrapper that your component will be listening to.
If your component isn't immediately reflecting the change in its display, this might mean you'll have to look into the redraw code of that component. The Tree control is pretty notorious for this kind of issue, mostly because updating can be expensive.