1. #1
    Sencha User
    Join Date
    Sep 2012
    Posts
    55
    Vote Rating
    0
    bunty is on a distinguished road

      0  

    Default Answered: Ext.selection.CheckboxModel help needed

    Answered: Ext.selection.CheckboxModel help needed


    I want to get the 1st column value when i select a row. below code is returning me undefined.


    Code:
    var sm = Ext.create('Ext.selection.CheckboxModel',{    	listeners: {
                select: function(this1, record,  index, eOpts ){
                    alert(record.get(index));
                }
        	}    	
        });
    need inputs.

  2. Code:
    alert(record.get(company));
    Should be:

    Code:
    alert(record.get('company'));

  3. #2
    Sencha User skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,338
    Answers
    498
    Vote Rating
    248
    skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of

      0  

    Default


    The get method of a record returns field values based on their name, not an index. e.g.:

    Code:
    record.get('age')
    So just pass it the field name, i.e. the dataIndex, of your first column.

  4. #3
    Sencha User
    Join Date
    Sep 2012
    Posts
    55
    Vote Rating
    0
    bunty is on a distinguished road

      0  

    Default


    its throwing exception: company not defined

    Code:
     ////////////////////////////////////////////////////////////////////////////////////////    // Grid 2
        ////////////////////////////////////////////////////////////////////////////////////////
        var sm = Ext.create('Ext.selection.CheckboxModel',{
        	listeners: {
                select: function(this1, record,  index, eOpts ){            	
                    alert(record.get(company));
                }
        	}
        	
        });
        var grid2 = Ext.create('Ext.grid.Panel', {
            store: getLocalStore(),
            selModel: sm,
            columns: [
                {text: "Company", width: 200, dataIndex: 'company'},
                {text: "Price", renderer: Ext.util.Format.usMoney, dataIndex: 'price'},
                {text: "Change", dataIndex: 'change'},
                {text: "% Change", dataIndex: 'pctChange'},
                {text: "Last Updated", width: 135, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
            ],
            columnLines: true,
            width: 600,
            height: 300,
            frame: true,
            title: 'Framed with Checkbox Selection and Horizontal Scrolling',
            iconCls: 'icon-grid',
            renderTo: Ext.getBody()
        });

  5. #4
    Sencha User
    Join Date
    Jul 2012
    Location
    France
    Posts
    159
    Answers
    2
    Vote Rating
    3
    Elfayer is on a distinguished road

      0  

    Default


    Try this :
    PHP Code:
    alert(this.getSelectionModel().getSelection()[0].data.company); 
    or (this is the same)
    PHP Code:
    alert(this.getSelectionModel().getSelection()[0].get('company')); 

  6. #5
    Sencha User skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,338
    Answers
    498
    Vote Rating
    248
    skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of

      0  

    Default


    Code:
    alert(record.get(company));
    Should be:

    Code:
    alert(record.get('company'));

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar