[CLOSED] GridPanel: When I update a value in the store object I wish update the gridPanel

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] GridPanel: When I update a value in the store object I wish update the gridPanel

    Hi!

    I wish when I update a value in store object, the value are update (reloaded?) in the GridPanel.

    How I do this?

    Thanks for any help!
    Last edited by Daniil; Jul 02, 2012 at 11:28 AM. Reason: [CLOSED]
  2. #2
    Hi,

    How do you change the Store data?

    This way?
    record.data.someField= "new value";
    If yes, then you need to refresh the GridPanel View.
    grid.getView().refresh();
    Or you can use the record set method. It is the best when you need to set up just a single record field.
    record.set("someField", "new value");
    Or the beginEdit and endEdit methods for editing several record fields.
    record.beginEdit();
    record.data.soeField1 = "new value 1";
    record.data.soeField2 = "new value 2";
    record.endEdit();
    The changes will be automatically refreshed in the grid.

    If you change many records and many fields in the Store data, it would best to use the first approach.
  3. #3
    Ok!

    Thanks Daniil!
  4. #4
    Quote Originally Posted by supera View Post
    Ok!

    Thanks Daniil!


    Hi you managed to get it work ? Where is the 'record' object from ?
  5. #5
    It can be retrieved from a Store.
    var record = store.getAt(0);
  6. #6
    Great.. this is working...

    record.Set("xxx", 888)
    I am doing this in OnBeforeStoreChanged, is this a good place ? FYI. I wish to do some calculations based on some tables in the DB.
    Last edited by geoffrey.mcgill; Jan 27, 2015 at 5:04 PM.
  7. #7
    I would avoid such an operation in a OnBeforeStoreChanged handler.

    The modified records should be returned in a response of a save request. Please see e.ResponseRecords here.
    https://examples2.ext.net/#/GridPane...s/StoreEvents/
  8. #8
    But I need to recalculate after changing the value in the cell..(based on some db rates/calculations), where is the best event for this ?
    Last edited by geoffrey.mcgill; Jan 27, 2015 at 5:04 PM.
  9. #9
    You can change returned records as you need.
  10. #10
    Quote Originally Posted by Daniil View Post
    You can change returned records as you need.

    Like this ?

    protected void Store1_BeforeChanged(object sender, BeforeStoreChangedEventArgs e)
        {
            this.db = new NorthwindDataContext();
            this.responseRecords = new List<object>();
        }
    I dont see what is this code doing. Perhaps I miss something ?

    Thank you !!!
    Last edited by Daniil; Aug 05, 2013 at 4:35 PM. Reason: Please use [CODE] tags
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] loop though gridpanel and update store
    By nhg_itd in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Oct 03, 2011, 8:11 AM
  2. Replies: 2
    Last Post: Sep 13, 2011, 10:49 AM
  3. Replies: 2
    Last Post: May 16, 2011, 9:19 PM
  4. Update GridPanel With Store Values
    By Ganesh3.shirsath in forum 1.x Help
    Replies: 0
    Last Post: Oct 20, 2010, 2:42 PM
  5. [CLOSED] Update GridPanel from Store
    By danielg in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 12, 2009, 11:44 AM

Posting Permissions