1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    33
    Vote Rating
    0
    ps_arunkumar is on a distinguished road

      0  

    Default how set selected row in default when load gridpanel using checkbox selection model?

    how set selected row in default when load gridpanel using checkbox selection model?


    hi,

    i am using extjs 4.0.2a.

    in gridpanel using Ext.selection.CheckboxModel.

    my json data
    Code:
    ({"totalCount": 5, "dataRows": [{"checked": true, "name": "User1", "date": "13/06/1982"},{"checked": false, "name": "User2", "date": "13/06/1983"},{"checked": true, "name": "User3", "date": "13/06/1984"},{"checked": false, "name": "User4", "date": "13/06/1985"},{"checked": false, "name": "User5", "date": "13/06/1986"}]} )
    Grid Plugins Example_1333975518359.jpg

    when gridpanel render check dataIndex checked is true or not. if true mean checkbox is checked otherwise not checked. is it possible to integrate this logic in Ext.selection.CheckboxModel.

    i try this
    Code:
    listeners: {                        afterrender: function() {
                                var current_grid = this;
                                store.on('load', function(){
    			    
                                    var data = current_grid.getStore().data.dataRows;
    				
                                    var recs = [];
                                    Ext.each(data, function(item, index){
    				
                                        if (item.data.checked) {
                                            recs.push(index);
                                        }
                                    });
    				current_grid.getSelectionModel().selectRows(recs);
                                   
                                })
                            }
                        }

    but no luck. any one give suggestion please.

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,627
    Vote Rating
    399
    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


    Here is some code I used to select checkbox items in a grid:

    Code:
    this.gridB.getSelectionModel().on('select', function(selModel, model) {
        // make call to server to get subfields, data is created from gridB subfields list, not from table
        // table is used to check selected subfields below using ajax call on success
        Ext.Ajax.request({
            method: 'POST',
            url: 'index.php/mapper/get_tag_subfields/',
            scope: this,
            params  : {
                id: this.gridB.getSelectionModel().getSelection()[0].data.id,
            },
            success: function(xhr) {
                var json = Ext.decode(xhr.responseText); // make sure to decode for loadData to work
    
                // data is formatted, just need to load data
                storeMapperSubfields.loadData(json.data);
                // mark checkboxes
                if (json.data.length){
                    for (var i = 0; i < json.data.length; i++){
                        var rec = this.gridC.store.getById(json.data[i].id); // json.data[i].getId()
                        if (rec.data.field_type == 's'){ // select all records have have 's'
                            this.gridC.getSelectionModel().select(rec,true,false);
                        }
                    }
                }
            },
            failure: function() {
                Ext.getBody().unmask();
                alert('AJAX FAILURE: Unable to process call');
            }
        });
    }, this);
    Regards,
    Scott.

Thread Participants: 1

Tags for this Thread

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