Home >Web Front-end >JS Tutorial >How ExtJS Grid uses SimpleStore and multi-select boxes_extjs

How ExtJS Grid uses SimpleStore and multi-select boxes_extjs

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 18:41:271185browse
复制代码 代码如下:

///
Ext.onReady(function(){
var data = [
[1,"wilson.fu",10],
[2,"wilson.fu2",20],
[3,"wilson.fu3",30]
];

var sqldata = new Array() ;
for(var i=0;i<10;i )
{
sqldata.push([i.toString(),"wilson.fu" i.toString(),10*i]);
}

var sm = new Ext.grid.CheckboxSelectionModel({handleMouseDown:Ext.emptyFn});
var cm = new Ext.grid.ColumnModel([
sm,
{header:"编号",dataIndex:"id",sortable:true},
{header:"姓名",dataIndex:"name"},
{header:"排序值",dataIndex:"ordernum",sortable:true}
]);

var store = new Ext.data.SimpleStore({
fields:[
{name:"id"},
{name:"name"},
{name:"ordernum"}
]
});

store.loadData(sqldata);

var gd = new Ext.grid.GridPanel({
renderTo:"grid",
cm:cm,
sm:sm,
store:store,
loadMask:true
});

Ext.get("btn").on("click",function(){
var selections = gd.getSelectionModel().getSelections();
debugger
//得到选择的行的值
});

});
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn