Flex DataGrid - Operations in DataProvider.


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.

pdf version temporarily unavailable.
Leave a comment or a Trackback

9 Comments

  1. Leonardo
    March 26, 2008 11:00 am | Permalink

    Congratulations !!!!!!!!!!!!!!!!! explanation for his 11

  2. villas
    April 17, 2008 at 10:23 a.m. am | Permalink

    Because the forefront when you change something gives the message that the field is empty or online?

  3. April 17, 2008 at 11:14 a.m. am | Permalink

    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.

  4. Thiago
    November 10, 2008 at 5:58 pm | Permalink

    And to add a new record?

  5. November 11, 2008 at 1:44 pm | Permalink

    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.

  6. November 18, 2008 at 10:42 a.m. pm | Permalink

    Ya at this link the need for something asi el style: '(

  7. November 19, 2008 at 7:05 am | Permalink

    ¿Hola Jesus, in the view ... you can see in the source code to the need something more specific?

  8. November 21, 2008 at 8:26 am | Permalink

    No conclusions can be see the examples.

  9. November 21, 2008 at 8:31 am | Permalink

    See: http://www.msdevstudio.com/blog/flexSource/testDatagrid/

Leave a comment

Your email is never published or shared. Required fields are marked with an *