ExtJS Grid使用SimpleStore、多选框的方法
程序员文章站
2022-06-17 17:01:31
复制代码 代码如下:/// ext.onready(function(){ va...
复制代码 代码如下:
///<reference path="./vswd-ext_2.0.2.js" />
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
//得到选择的行的值
});
});
上一篇: Vue2.0父子组件传递函数的教程详解
下一篇: 哪种蔬菜好吃又营养