I changed SampleGrid to remoteSort but failed

  • I try to extend GridPanel to SampleGrid with remoteSort mode.but failed.
    It show the error message "undefined".

    SampleGrid = function(){
    var cm = new Ext.grid.ColumnModel([
    new Ext.grid.RowNumberer(),
    {header:'field 1',dataIndex:'name'},
    {header:'field 2',dataIndex:'occupation'}
    ]);
    cm.defaultSortable = true;

    var ds = new Ext.data.Store({
    proxy: new Ext.data.HttpProxy({url:'datas.jsp'}),
    reader: new Ext.data.XmlReader({
    totalRecords: 'results',
    record: 'row'
    }, [{name: 'name'},
    {name: 'occupation'}
    ]
    ),
    remoteSort: true
    });
    ds.load({params:{start:0,limit:10}});

    SampleGrid.superclass.constructor.call(this, {
    id:'mygrid',
    loadMask: true,
    title:'mytest',
    store:ds,
    columns: cm,
    height:250,
    width:600
    });
    }
    Ext.extend(SampleGrid, Ext.grid.GridPanel);

    Ext.onReady(function() {

    var window = new Ext.Window({
    title: 'Resize Me',
    width: 500,
    height:300,
    minWidth: 300,
    minHeight: 200,
    layout: 'fit',
    plain:true,
    bodyStyle:'padding:5px;',
    buttonAlign:'center',
    items: new SampleGrid(),
    buttons: [{
    text: 'Send'
    },{
    text: 'Cancel'
    }]
    });
    window.show();

    }
    );


  • thanks


  • columns: cm,

    should be:

    cm: cm

    (you're specifying a columnmodel, not an array of columns)