Results 1 to 5 of 5

Thread: Changing the value of a field wont send an "update" it always sends a "create"

  1. #1

    Default Changing the value of a field wont send an "update" it always sends a "create"

    Code:
    /*
     * File: Ext.spmd.Account.ui.js
     * Date: Mon Jul 12 2010 21:44:21 GMT-0700 (Pacific Daylight Time)
     * 
     * This file was generated by Ext Designer version xds-1.0.2.0.
     * http://www.extjs.com/products/designer/
     *
     * This file was manually exported.
     */
    
    Ext.spmd.AccountUi = Ext.extend(Ext.Panel, {
        title: 'Account Manager',
        width: 721,
        layout: 'fit',
        autoScroll: true,
        initComponent: function() {
            this.items = [
                {
                    xtype: 'editorgrid',
                    autoExpandColumn: 'description',
                    border: false,
                    id: 'account_grid',
                    columns: [
                        {
                            xtype: 'numbercolumn',
                            dataIndex: 'code',
                            header: 'Account ID',
                            sortable: true,
                            width: 100,
                            format: 0,
                            id: 'code',
                            editor: {
                                xtype: 'textfield'
                            }
                        },
                        {
                            xtype: 'gridcolumn',
                            dataIndex: 'name',
                            header: 'Account Name',
                            sortable: true,
                            width: 100,
                            id: 'name',
                            editor: {
                                xtype: 'textfield'
                            }
                        },
                        {
                            xtype: 'gridcolumn',
                            header: 'Description',
                            sortable: true,
                            width: 100,
                            dataIndex: 'description',
                            id: 'description',
                            editor: {
                                xtype: 'textfield'
                            }
                        }
                    ],
                    bbar: {
                        xtype: 'paging',
                        id: 'account_pagingtoolbar',
                        items: [
                            {
                                xtype: 'tbseparator'
                            },
                            {
                                xtype: 'button',
                                text: 'ADD',
                                id: 'account_addbutton'
                            },
                            {
                                xtype: 'tbseparator'
                            },
                            {
                                xtype: 'button',
                                text: 'REMOVE',
                                id: 'account_removebutton'
                            },
                            {
                                xtype: 'tbfill'
                            },
                            {
                                xtype: 'button',
                                text: 'SAVE',
                                id: 'account_savebutton'
                            },
                            {
                                xtype: 'tbseparator'
                            },
                            {
                                xtype: 'button',
                                text: 'EXIT',
                                id: 'account_exitbutton'
                            }
                        ]
                    }
                }
            ];
            Ext.spmd.AccountUi.superclass.initComponent.call(this);
        }
    });

    Code:
    /*
     * File: Ext.spmd.store.AccountStore.ui.js
     * Date: Mon Jul 12 2010 21:44:33 GMT-0700 (Pacific Daylight Time)
     * 
     * This file was generated by Ext Designer version xds-1.0.2.0.
     * http://www.extjs.com/products/designer/
     *
     * This file was manually exported.
     */
    
    Ext.spmd.store.AccountStore = Ext.extend(Ext.data.JsonStore, {
        constructor: function(cfg) {
            cfg = cfg || {};
            Ext.spmd.store.AccountStore.superclass.constructor.call(this, Ext.apply({
                storeId: 'account',
                root: 'data',
                sortField: 'code',
                autoLoad: true,
                remoteSort: true,
                api: { 
                    read: '../../index.php/account/read',
                    update: '../../index.php/account/update',
                    create: '../../index.php/account/create',
                    destroy: '../../index.php/account/destroy'
                },
                baseParams: {
                    passcode: 'account'
                },
                writer: new Ext.data.JsonWriter({
                    encode: true,
                    writeAllFields: true 
                }),
                fields: [
                    {
                        name: 'code'
                    },
                    {
                        name: 'name'
                    },
                    {
                        name: 'description'
                    }
                ]
            }, cfg));
        }
    });
    new Ext.spmd.store.AccountStore();
    Code:
    Ext.spmd.activator.Account = function() {
        //retrieve the store
        var account_store = Ext.StoreMgr.lookup('account');
        
        //check if an instance of the account manager panel already exist, if it doesnt...create a new one
        if(!Ext.spmd.activator.AccountAttributes.AccountEditor) {
            Ext.spmd.activator.AccountAttributes.AccountEditor = new Ext.spmd.AccountUi();
            Ext.getCmp('account_grid').reconfigure(account_store,Ext.getCmp('account_grid').getColumnModel());
        }
        //bind the listeners
        
        //bind the store
        Ext.getCmp('account_pagingtoolbar').bindStore(account_store);
        
        //add the panel to the container
        Ext.getCmp('index_tabpanel').add(Ext.spmd.activator.AccountAttributes.AccountEditor);
    };
    
    Ext.namespace('Ext.spmd.activator.AccountMethods');
    Ext.namespace('Ext.spmd.activator.AccountAttributes');
    
    //pointer to the single instance of the grid
    Ext.spmd.activator.AccountAttributes.AccountEditor = null;







    when i change the value of a field....

    instead of an "update" .....a "create" url is called in the background.

    Yoda needs help TT___TT

    http://sphotos.ak.fbcdn.net/hphotos-..._5378434_n.jpg
    Last edited by Yoda; 12 Jul 2010 at 6:29 AM. Reason: added an image link

  2. #2

    Default

    *bump*

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

    Default

    This can only work if you configure an idProperty in the store (reader).

  4. #4

    Default

    ohhh......how stupid of me. tnx for saving my life.

  5. #5

    Default

    I also have this problem. Creating a Store (Reader) idProperty does NOT solve this problem. I have my JsonReader with the idProperty and it correctly matches my Json result but it doesn't resolve this issue.

    What did you do that actually fixed the problem?

Similar Threads

  1. "Group By This Field" and "Show in groups"
    By vick in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 24 Mar 2010, 6:53 AM
  2. Replies: 3
    Last Post: 28 Oct 2009, 6:38 AM
  3. How to mark "dirty" field as "clean"
    By arthurakay in forum Ext 2.x: Help & Discussion
    Replies: 6
    Last Post: 9 Oct 2008, 8:17 AM
  4. replace the "south" with the "new Ext.StatusBar" in "layout:'border'"
    By ealpha in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 18 May 2008, 8:28 PM

Posting Permissions

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