Results 1 to 2 of 2

Thread: How I can to change store using grid?

  1. #1

    Default How I can to change store using grid?

    My mode

    Code:
    Ext.define('MyApp.model.User', {
        extend: 'Ext.data.Model',
    
    fields: [
            'firstName', 'lastName', 'phoneNumber', 'email'
    ],
    
    });
    My store
    Code:
    Ext.define('MyApp.store.Users', {
        extend: 'Ext.data.Store',
    
    model: 'MyApp.model.User',
    
    alias: 'store.users',
    
    requires: [
            'MyApp.model.User'
    ],
    
    data: [
              {   firstName: 'Jean',      lastName: 'Grey',       phoneNumber: '(321) 341-2312',      email: '[email protected]' },
    {   firstName: 'Phillip',   lastName: 'Fry',        phoneNumber: '(421) 321-5531',      email: '[email protected]'},
    {   firstName: 'Peter',     lastName: 'Quill',      phoneNumber: '(412) 323-9312',      email: '[email protected]' },
    
    ],
    });
    My grid.
    Code:
    Ext.define('MyApp.view.main.UserList', {
    
        extend: 'Ext.grid.Panel',
    
    alias: 'widget.mainUserList',
    
    requires: [
            'Ext.form.field.Text',
    'Ext.grid.column.RowNumberer',
    'Ext.grid.plugin.RowEditing',
    'MyApp.store.Users'
    ],
    
    plugins: [
            {
                ptype: 'rowediting',
    clicksToEdit: 2,
    },
    ],
    selType: 'rowmodel',
    
    store: {
            type: 'users',
    },
        
    tbar:
            [
                {
                    text: 'Add Plant',
    handler: 'addOnButtonClick',
    },
    ],
    columns: [
            {
              xtype: 'rownumberer',
    },
    {
                text: 'Name',
    dataIndex: 'firstName',
    flex: 1,
    editor:
                    {
                        xtype: 'textfield',
    allowBlank: false,
    }
            },
    {
                text: 'Surname',
    dataIndex: 'lastName',
    flex: 1,
    editor:
                    {
                        xtype: 'textfield',
    allowBlank: false,
    }
            },
    {
                text: 'Phone Number',
    dataIndex: 'phoneNumber',
    flex: 1,
    editor:
                    {
                        xtype: 'textfield',
    allowBlank: false,
    }
            },
    {
                text: 'eMail',
    dataIndex: 'email',
    flex: 1,
    editor:
                    {
                        vtype: 'email',
    allowBlank: false,
    }
            },
    ],
    });
    I can to change on lochalhost, but app doesn't save my changes. Can u help me?

  2. #2
    Sencha User
    Join Date
    Oct 2018
    Location
    Noida
    Posts
    56
    Answers
    10

    Default

    You can define proxy to store for saving its data and call sync method of store to save all data at one shot.
    OR
    You can call each record save proxy once you are done with all changes for a particular row.

Similar Threads

  1. Replies: 2
    Last Post: 22 Sep 2015, 1:17 PM
  2. Change grid header and store dataindex
    By JNason in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 28 Oct 2008, 12:55 PM
  3. Change the store of a grid
    By vendiddy in forum Ext 2.x: Help & Discussion
    Replies: 6
    Last Post: 23 Jan 2008, 4:31 PM
  4. [SOLVED] Updating grid after store change
    By hga77 in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 8 Oct 2007, 3:48 AM
  5. Updating grid after store change
    By purge in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 28 Jun 2007, 3:43 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
  •