Results 1 to 3 of 3

Thread: Writer not updating dirty records in grid using store.save()

  1. #1
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,409

    Default Writer not updating dirty records in grid using store.save()

    I have been trying to my app running using ScriptTagProxy,JsonWriter,JsonStore.

    {success: true} is echo'd in the php
    json is populated in XHR using ajax approach, not in store.save()

    I have ... reviewed the writer example, reviewed many examples, researched the forum until my eyes bleed.
    I have seen other reports of this, but I was not sure if it was resolved, as there was no mention of the solution.

    I have step through my code using firebug. The save function seems to populate rs, etc in walk through of store.save ...but 'post' and 'response' are not sent.

    If I use Ext.Ajax.request(), it seems to work fine. Hopefully this is a simple setting that I am overlooking.

    Here is some of my code. Please let me know if I need to provide more info: (yes I used XDS for now)

    Side note: Are they any working _simple_ examples using using this approach? (api,writer,php,sql). The writer example is impressive, but a bit overwhelming when you first getting started.

    Regards,
    Scott.

    Code:
    var proxy = new Ext.data.ScriptTagProxy({
      api: {
        read : 'data_query.php',
        create : 'data_create.php',
        update: 'data_update.php',
        destroy: 'data_delete.php'
      }
    });
    Code:
    store_users = Ext.extend(Ext.data.JsonStore, {
      constructor: function(cfg) {
        cfg = cfg || {};
        store_users.superclass.constructor.call(this, Ext.apply({
          proxy: proxy,
          storeId: 'store_users',
          root: 'users',
    //      url: '../data/bms_users.json',
          autoLoad: true,
          autoSave: false,
          successProperty : 'success',
          totalProperty : 'totalCount',
          idProperty: 'id_user',
          reader: reader,
          writer: writer,
          listeners: {
            exception: function() {
              console.info(arguments);
            }
          },
          fields: [.. ]
        },cfg));
      }
    });
    new store_users();
    tbar:
    Code:
             xtype: 'button',
             text: 'Save',
             handler: onSave <- ajax approach works
    /*         
             handler: function(){
               var mystore = Ext.StoreMgr.get('store_users');
    //           mystore.commitChanges(); <- changes dirty status
               mystore.save(); <-dirty status does not change
             }
    */          
           },

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246

    Default

    Your server needs to return the new/updated record data after a create or update.

  3. #3
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,409

    Default

    Where was the problem. I needed to add the callback.
    http://www.sencha.com/forum/showthread.php?22990

    Regards,
    Scott.

Similar Threads

  1. Updating Records of a Data Store
    By aconran in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 13 Feb 2015, 4:34 AM
  2. Replies: 2
    Last Post: 6 Aug 2010, 10:43 AM
  3. Replies: 13
    Last Post: 31 Mar 2010, 1:11 AM
  4. Updating records in a grid - prevent scroll & dirty marker
    By Rob Wilson in forum Ext 2.x: Help & Discussion
    Replies: 6
    Last Post: 4 Feb 2009, 11:27 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •