Custom ArrayCollections, Adding New Items to DataGrid
The previous posts used custom ILists to merge or concatenate other ILists. This example uses a custom subclass of ArrayCollection to fake an empty object at the end of the actual ArrayCollection which can be used to add new entries to the DataGrid.
If the user fills out the new entry, it is added to the actual collection and another new entry is faked. Additional logic dictates that if the user strips all information out of an entry, that entry is removed from the actual collection.
Usual caveats apply
Comments
Hi Alex,
First of all awesome posts from you and I am glad you find some time out of FlexCoder :)
If I may make a suggestion, would you mind enabling the source instead of having separate link to download the code? You might have your own reason, but for those who are interested in checking out the code, they can do so easily without downloading and find the text editor to open up the files.
--------------------
Alex responds:
Unfortunately, the blog software we use doesn't allow multiple file or entire folder uploads making the posting of the view source too time consuming. I have limited time to cook up these posts and view source support would add a significant time cost. Sorry.
Posted by: Myo | March 12, 2008 09:56 AM
Hi Alex,
Is there any idea to delete items from datagrid? and can we adding canvas to datagrid columns?
--------------------
Alex responds:
To delete, you normally call removeItemAt on the dataprovider. You can add a Canvas as the renderer, but I discourage it for performance reasons. See the posts in the item renderer category for more details.
Posted by: nadh | March 21, 2008 02:14 AM
Nice application, only one bug:
try to edit one name and then (with the row in edit mode) click to sort a column. It will result a double entry
------------------
Alex responds:
Usual caveats apply. Code on this blog is generally unsupported.
Posted by: Luke | June 13, 2008 11:13 AM