views:

475

answers:

2

I am trying to extend the flex datagrid component so that I can have an "add new row" row like MS Access but I can't get it to work. I have tried a few different methods but I can't get anything to actually work.

By extend I really mean alter the Adobe code as some of the private vars I needed to do something else but I should be able to merge extend code with Adobe's.

Thanks for your help.

+1  A: 

You have to make the datagrid editable and then add a new object (or whatever you are using) with empty data to the datagrid's data provider.

Here is an example I have created.

Thomas
It is editable. I am using an `ArrayCollection`. I have tried that and added that code to `updateDisplayList` and invalidate it on change but it does nothing. If I remove the `invalidateDisplayList()` from my `addRows` setter, it will show but only when I click to edit another cell! Any more advice?
pedro_sland
I've created an example, see my edit.
Thomas
Thanks very much. I discovered that something was overwriting my `dataProvider` just after it added that row. Your example made me realise that my datagrid code was fine :)
pedro_sland
A: 

Hi Thomos,

I am new to flex and i have the same requirement. Can you please help me out how to do this with some sample code?

I have the editable dataGrid and want to know how to add the blank record to the data provider and selecting the index.

Thanks for your time and help.

  • Varma
Balakrishna Chamarthi
When you add your `dataProvider`, just add an extra row on the end. Use an event listener to see if that row is clicked and start editing.Thomas's example is view-source enabled (thats the first context menu item) and you can see what he did with Flex 4.
pedro_sland