Ext中Grid得到选择行数据的方法总结

来源:互联网 发布:海马模拟器 mac 编辑:程序博客网 时间:2024/05/17 23:28

1)grid.getStore().getRange(0,store.getCount());    //得到grid所有的行

 

(2)grid.getSelectionModel().getSelections();        //得到选择所有行    

注:如果不声明var sm = new Ext.grid.CheckboxSelectionModel();则会报此句没有该对象或属性

Var selectRows = grid.getSelectionModel().getSelections();

selectRows[0].get(“gird中某列的dataIndex属性值”)        //取选中行记录的某列的值

 

(3)grid.selModel.selections.items;              //得到选择所有行

 

(4)grid.getSelectionModel().getSelected();      //得到选择行的第一行

 

 

单击gird中某一行时取得该行的数据

proLevelGrid.on('rowclick', function(proLevelGrid,rowIndex,event){

       var record = proLevelGrid.getStore().getAt(rowIndex);

    addProductLevel_form.getForm().loadRecord(record);

    alert(record.get('id'));

});

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/ljleiwf/archive/2010/07/14/5733792.aspx

原创粉丝点击