[Extjs]window中grid的checkbox全选问题我将gird放到formpanel内,formpanel放在window内,想在window显示后全选gird内的checkbox,但不能全选,在window内的button却可以全选
var cs_sm=new Ext.grid.CheckboxSelectionModel(); var ds = new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({
url: BASE_URL+'size',
method: 'GET'
}),
        autoDestroy: true,
        root: 'list',
        totalProperty: 'total',
        idProperty: 'id',
        remoteSort: true,
fields: [
{name: 'id',mapping:'id',type:'int'},
{name: 'name',mapping:'name',type:'string'}
],
        sortInfo: {field:'id', direction:'ASC'}
});
ds.load();

var cs_grid = new Ext.grid.GridPanel({
border: false,
id: 'size_grid',
sm: cs_sm,
store: ds, 
loadMask: true, 
layout: 'fit',
autoScroll: true,
height: 150,
columns: [
cs_sm,
{
header: 'ID',
dataIndex: 'id',
width: 30,
hidden: true
},{
header: 'name',
dataIndex: 'name',
width: 100,
menuDisabled : true
},{
header: 'value',
dataIndex: 'value',
width: 100,
menuDisabled : true,
editor: new Ext.form.TextField({
allowBlank: false
})
}
]
});

//get list by JSON
var store = new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({
url: BASE_URL+'list',
method: 'GET'
}),
        autoDestroy: true,
        root: 'list',
        totalProperty: 'total',
        idProperty: 'id',
        remoteSort: true,
fields: [
{name: 'id',mapping:'id',type:'int'},
{name: 'create_date',mapping:'create_date',type:'string'}
],
        sortInfo: {field:'contract_no', direction:'ASC'}
});
store.load();

var sm = new Ext.grid.CheckboxSelectionModel();

    //grid
    var grid = new Ext.grid.GridPanel({
        store: store,
        renderTo: 'contract_list',
layout: 'fit',
sm: sm,
loadMask: true,
height: 300,
columns: [
sm,
{
            header: 'ID',
            dataIndex: 'id',
width: 30,
hidden: true
        },{
            header: 'create date',
            dataIndex: 'create_date',
width: 150,
sortable: true,
        }],
tbar: [{
            text: App.lang._new,
            iconCls: 'silk-add',
handler: function(){
loadFormData();
}
        }]
    });

function createForm(){
cform = new Ext.FormPanel({
id: 'cform',
frame:true,
buttonAlign: 'center',
items: [cs_grid],        
buttons: [{
text: 'select all',
handler: function(){
var sm=Ext.getCmp('size_grid').getSelectionModel();
sm.selectAll();
}
},{
text: 'cancel'
}]
});
}

function openWin(show){
createForm();
cwin = new Ext.Window({
id: 'cwin',
title: 'info',
width: 700,
height: 400,
minWidth: 700,
minHeight: 400,
layout: 'fit',
modal: true,
draggable: false,
resizable: false,
plain:true,
buttonAlign: 'center',
items : [cform]
});
if(show)cwin.show();
}
    
function loadFormData(){
openWin(false);
/*
* do something before show
*/
cwin.show();
//cs_sm.selectAll();
//Ext.getCmp('size_grid').getSelectionModel().selectRow(1);
Ext.getCmp('size_grid').getSelectionModel().selectAll();// not work
}
size JSON{"total":9,"list":[{"id":"1","name":"20'"},{"id":"2","name":"40'"},{"id":"3","name":"40'HQ"},{"id":"4","name":"45'"},{"id":"5","name":"60"},{"id":"6","name":"70"},{"id":"7","name":"80"},{"id":"8","name":"90"},{"id":"9","name":"100"}]}