Store.loadData()

  1. #1

    Store.loadData()

    I have a store with an ArrayReader attached to a GridPanel. I am collecting information from the user and attempting to add/edit records and store them in the grid.

    After entering data into the UI I add a record via this server side code

    TimesheetItem item = new TimesheetItem();
    item.TimesheetId = counter++;
    .
    .
    .
    
    this.storeTimesheets.InsertRecord(0, ObjectUtil.TurnObjectIntoDictionary(item);
    this.storeTimesheets.CommitChanges();
    This works fine and updates the grid with my new records.

    When a user wants to edit the data they click the grid and a popup window is presented. When they finish editing the data I am trying to update the record in the grid with store.loadData()

     this.storeTimesheets.LoadData(JSON.Serialize(item));
    
    on the client side it looks like this
    
    ctl00_ContentPlaceHolder1_storeTimesheets.loadData({"TimesheetId":1,"JobId":"","WorkOrderId":2108,"WorkOrderNo":"3200004","StateId":0,"State":"NSW","OpSuffix":"","Date":"2011-12-21T00:00:00","EmployeeId":6227,"Employee":"70005643  - ANGUS  AITCHISON","SiteRateCodeId":90,"SiteRateCode":"200","PayrollQty":2.0,"InvoiceQty":2.0,"Note":"","DelayCodeId":0,"DelayCode":null,"DateWorked":null});
    This just wipes out any data that is in the grid. Am I doing this correctly? Should I be using a different method?

    Thanks for anyone who can help.
  2. #2
    I think the method is wrong. It will wipe out all data in the store not just the one I'm editing. Could someone tell me how to update one record in the store?

    I see there is store.addRecord() and store.insertRecord() but there doesn't seem to be a method to update a record? Is it possible?
  3. #3
    LoadData method works as designed
    See http://docs.sencha.com/ext-js/3-4/#!...ethod-loadData

    To update please use
    - on the server side: UpdateRecordField method of store
    Store1.UpdateRecordField(rowIndex, dataIndex, value);
    - on the client side
    var record = Store1.getAt(rowIndex); //or getById
    record.beginEdit();
    record.set(dataIndex, value);
    //repeat set calling for other data indexes
    record.endEdit();
    Also see the following samples
    https://examples1.ext.net/#/GridPane...etails_Window/
    https://examples1.ext.net/#/GridPane...Window_Remote/

Similar Threads

  1. [CLOSED] [2.0] Razor and Store LoadData
    By Timothy in forum 2.x Legacy Premium Help
    Replies: 8
    Last Post: Jun 28, 2012, 6:45 PM
  2. About Ext.Net Store.loadData
    By caoit in forum 1.x Help
    Replies: 0
    Last Post: Apr 26, 2011, 2:41 AM
  3. [1.0] Store.LoadData vs DataBind
    By Kam in forum 1.x Help
    Replies: 1
    Last Post: Apr 19, 2011, 11:00 AM
  4. [CLOSED] Store loadData() wierd error.
    By capecod in forum 1.x Legacy Premium Help
    Replies: 9
    Last Post: Nov 10, 2010, 8:46 AM
  5. Ext.Net Store.loadData
    By cleve in forum 1.x Help
    Replies: 4
    Last Post: Jun 29, 2010, 4:19 PM

Posting Permissions