1. #1
    Sencha User
    Join Date
    Jul 2009
    Posts
    127
    Vote Rating
    1
    silve69 is on a distinguished road

      0  

    Default Using CheckboxModel with default checked rows

    Using CheckboxModel with default checked rows


    Hello folks,

    I'm using an Ext.selection.CheckboxModel in a grid, but I don't know how checked some rows by default.
    Code:
    var layers_store = new Ext.data.Store({
        autoLoad: false, 
        proxy: { 
            type: 'ajax', 
            url: 'modules/view.php', 
            reader: { 
                type: 'json', 
                root: 'results', 
                successProperty: 'success' 
            }, 
        },
        fields: [{name:'idlayer',type:'int'}, 'layer', {name:'checked',type:'int'}]
    });
    
    
    ...
    ...
    },{
        xtype: 'grid', 
        store: layers_store, 
        columnLines: true, 
        viewConfig: { stripeRows: true },
        selModel: Ext.create('Ext.selection.CheckboxModel'),
        columns: [{ header: 'Layers', dataIndex: 'layer' }]
    },{
    ...
    Received JSON:
    Code:
    [{"idlayer":"18","layer":"Towns","checked":"1"},{"idlayer":"19","layer":"Rivers","checked":"0"}]
    For treepanel only is necessary a "checked" field, but with the CheckboxModel doesn't works.
    Some suggestion??

    Best regards,
    Silver

  2. #2
    Sencha User
    Join Date
    Jun 2011
    Posts
    55
    Vote Rating
    0
    Gabanjo is on a distinguished road

      0  

    Default


    I don't think you can set it based on a property like you can for TreeStore. (I guess because it represents user selections not features of the data.)

    If that's right you'll have to do it in your code somewhere, maybe like this:

    Code:
       viewConfig: { stripeRows: true,
         listeners : {
              beforerefresh : function(view) {
                     var store = view.getStore();
                     var model = view.getSelectionModel();
                     var s = [];
                     store.queryBy(function(record) {
                           if (record.get('layer') === 'Rivers') {
                                  s.push(record);
                           }
                    });
                    model.select(s);
               },
        }
     },
    It would be a useful feature, so I hope I'm wrong.

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."