1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    25
    Vote Rating
    0
    akshar_jamgaonkar is on a distinguished road

      0  

    Default Unanswered: show a gird row selected depending upon coditions

    Unanswered: show a gird row selected depending upon coditions


    Hello All,

    I have a grid panel with

    selModel : Ext.create('Ext.selection.RowModel', {
    mode : 'SINGLE'
    })


    this grid panel is inside a formpanel, what i want is when it loads i show a specific row as selected. With every column of gridpanel associated with Renderer.


    I have tried many things like

    me.gridPanel.getSelectionModel().select(me.store.findRecord('id',1) )

    me.gridPanel.getSelectionModel().select(me.store.findRecord('id',1) .data)


    but iam unable to do this.


    Kindly let me know what mistake iam i doing...



    Thanks in advance.

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,079
    Answers
    674
    Vote Rating
    467
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Select is looking for an index, not a record return by findRecord

    Try the following:

    Code:
    Ext.create('Ext.data.Store', {
        storeId : 'simpsonsStore',
        fields  : ['name', 'email', 'change'],
        data    : {'items' : [
            { 'name' : 'Lisa',  'email' : 'lisa@simpsons.com',  'change' : 100  },
            { 'name' : 'Bart',  'email' : 'bart@simpsons.com',  'change' : -20  },
            { 'name' : 'Homer', 'email' : 'home@simpsons.com',  'change' : 23   },
            { 'name' : 'Marge', 'email' : 'marge@simpsons.com', 'change' : -11  }
        ]},
        proxy   : {
            type   : 'memory',
            reader : {
                type : 'json',
                root : 'items'
            }
        }
    });
    
    var grid = Ext.create('Ext.grid.Panel', {
        title      : 'Simpsons',
        store      : Ext.data.StoreManager.lookup('simpsonsStore'),
        columns    : [
            { header : 'Name', dataIndex : 'name' },
            { header : 'Email', dataIndex : 'email', flex : 1 },
            { header : 'Change', dataIndex : 'change' }
        ],
        height     : 200,
        width      : 400,
        renderTo   : Ext.getBody()
    });
    
    var index = grid.store.find('name','Bart');
    grid.getSelectionModel().select(index);
    ‚Äč
    Scott.

Thread Participants: 1

Tags for this Thread