I made this an example to try to explain to those who have doubts about how to perform operations (CRUD) in a datagrid. The example begins to show how to create a DataProvider to a DataGrid, and then make various types of operations such as:
-Changes to the data of a particular row and column.
-Delete the selected line
-Rebuilding automatically and randomly a new DataProvider
In this instance used features that can be used for any other DataProvider due to the reuse of functions, may be seen as some examples of "fill" a DataGrid and work with your DataProvider (arrayCollection) accessing their fields, as the DataProvider is "dynamic / Bindable" when it is updated data is updated automatically in the DataGrid.
It's a very simple example, but it saves many headaches, because many times you see people trying to get a field of the DataGrid through it, not even your DataProvider. In this example we used some "tricks" less common for dealing with the arrayCollection.
The functions have been optimized to the maximum to be reused in any other DataGrid with the same DataProvider thus sparing unnecessary code in a media-wide application.
They can see the example online here with the asset view source
Or see the source code here
Was it useful?
Hug.














9 Comments
Congratulations !!!!!!!!!!!!!!!!! explanation for his 11
Because the forefront when you change something gives the message that the field is empty or online?
Good villas!
Well, it happens by my lack of attention. Try this way:
Depending on saveData () inside the place where if you have "line> 0" put "line> = 0" and the same is true in the civil deleteLinha (), change is also where "line> 0" and put "line> = 0"
this is because the value of the line may be zero (first line).
So should work.
Thank you for repair!
cumps.
And to add a new record?
simply create a new object:
var obj: Object = new Object;
obj.campo1 = "9";
obj.campo2 = "1.56";
obj.campo3 = "3.3";
dados.addItem (obj);
And it is done
Hug.
Ya at this link the need for something asi el style: '(
¿Hola Jesus, in the view ... you can see in the source code to the need something more specific?
No conclusions can be see the examples.
See: http://www.msdevstudio.com/blog/flexSource/testDatagrid/