kris
kris

Reputation: 90

add a row to a datagrid where a user can input data in as3

what i am trying to achieve is to have data populate a datagrid from a query, this part works fine. but once the data has been populated i want to add an additional row which the user will be able to type into. so for example the grid will have 5 pre populated rows and then the 6th row will be empty cells which the user can edit. the final column of this row will either be a button or an image with the click property set. this will be used to run an update query to update the dataprovider of the datagrid.

Upvotes: 0

Views: 1346

Answers (2)

schwack
schwack

Reputation: 88

You will also need to set the 'editable' property of the grid to true. Set the selectionMode property to 'singleRow' Each column also has an individual 'editable' property so you can limit users to only changing certain properties.

As long as the data is simple text the default item editor (which is a textInput) will work fine. If you use an advancedDataGrid you can also include things like checkBoxes for Boolean data.

Upvotes: 1

huber.duber
huber.duber

Reputation: 796

This is pretty easy. Just add a new object in your List that is bound to the datagrid. For the final column you will need an item renderer.

Ex:

dataGrid.dataProvider = someList;

//later when it is populated
someList.addItem(new Item());

After this you can set the focus to the desired column and the last row to show its input time.

You can also remove the last added item from the list to simulate a cancel action.

Upvotes: 1

Related Questions