<link rel=
"stylesheet"
type=
"text/css"
href=
"extjs/resources/css/ext-all.css"
/>
<script type=
"text/javascript"
src=
"extjs/adapter/ext/ext-base.js"
></script>
<script type=
"text/javascript"
src=
"extjs/ext-all.js"
></script>
<script>
var
aData = [[
'11'
,
'12'
],[
'21'
,
'22'
],[
'31'
,
'32'
],[
'41'
,
'42'
]];
Ext.onReady(
function
(){
var
oRecord = Ext.data.Record.create([
{name:
'f1'
, type:
'string'
},
{name:
'f2'
, type:
'string'
}
]);
var
store =
new
Ext.data.Store({
proxy:
new
Ext.data.MemoryProxy(aData),
reader:
new
Ext.data.ArrayReader({},oRecord)
});
store.load();
var
sm =
new
Ext.grid.CheckboxSelectionModel({singleSelect:
false
});
var
columns =
new
Ext.grid.ColumnModel([
new
Ext.grid.RowNumberer(),
sm,
{header:
'字段1'
, dataIndex:
'f1'
},
{header:
'字段2'
, dataIndex:
'f2'
}
]);
grid =
new
Ext.grid.GridPanel({
title:
'列表'
,
autoHeight:
true
,
region:
'center'
,
loadMask:
true
,
store: store,
cm: columns,
sm: sm,
renderTo:
'pad'
});
setTimeout(
function
(){
grid.selModel.selectRows([0,2]);
},300);
});
</script>
<div id=
'pad'
></div>
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步