I am using a datagrid. It has itemEditor components, combo boxes, etc. as aprt of columns. Ideally datagrid.invalidateList() method works to reload the datagrid with new dataProvider data.
我正在使用数据网格。它有itemEditor组件,组合框等作为列的列。理想情况下,datagrid.invalidateList()方法可以使用新的dataProvider数据重新加载数据网格。
But, for me it is appending to the old data and new data gets added below the older data. I am not able to fix this reload of datagrid.
但是,对我而言,它附加在旧数据上,新数据会添加到旧数据之下。我无法修复datagrid的重新加载。
3 个解决方案
#1
Use ArrayCollection, not Array! ArrayCollection provides all the change notification machinery you need. Array does not.
使用ArrayCollection,而不是Array! ArrayCollection提供您需要的所有更改通知机制。数组没有。
#2
I'm having a little trouble understanding exactly what your problem is. Can't you just replace DataGrid.dataProvider with the new collection?
我很难理解你的问题究竟是什么。你能不能用新的集合替换DataGrid.dataProvider?
#3
Well I got that. I just had to make my array empty.
好吧,我明白了。我只是让我的阵列空了。
so now its likeif arr is an array acting as dataprovider.
所以现在它的likeif arr是一个充当数据提供者的数组。
arr=[];
This makes the array empty and then i make it as dataprovider.
这使得数组为空,然后我将其作为数据提供者。
#1
Use ArrayCollection, not Array! ArrayCollection provides all the change notification machinery you need. Array does not.
使用ArrayCollection,而不是Array! ArrayCollection提供您需要的所有更改通知机制。数组没有。
#2
I'm having a little trouble understanding exactly what your problem is. Can't you just replace DataGrid.dataProvider with the new collection?
我很难理解你的问题究竟是什么。你能不能用新的集合替换DataGrid.dataProvider?
#3
Well I got that. I just had to make my array empty.
好吧,我明白了。我只是让我的阵列空了。
so now its likeif arr is an array acting as dataprovider.
所以现在它的likeif arr是一个充当数据提供者的数组。
arr=[];
This makes the array empty and then i make it as dataprovider.
这使得数组为空,然后我将其作为数据提供者。