Ext.onReady(function(){
var cm = new Ext.grid.ColumnModel([
{header:'编号',dataIndex:'col1',align:'right',sortable:true,width:50},
{header:'证件类型',dataIndex:'col2',sortable:true,width:150},
{header:'证件号码',dataIndex:'col3',sortable:true,width:70},
{header:'姓名',dataIndex:'col4',sortable:true,width:70}
]);
var store = new Ext.data.Store ({
proxy:new Ext.data.HttpProxy({url:'./../../employee/findAll.action'}),
reader: new Ext.data.XmlReader({
record: 'line',
totalProperty:'total'
},[
{name: 'col1',mapping:'col1'},
{name: 'col2'},
{name: 'col3'},
{name: 'col4'}
])
});
store.load();
//定义面板,显示列表
var grid = new Ext.grid.GridPanel({
store:store,
cm:cm,
loadMask:true,
title:'人员管理',
sm:new Ext.grid.RowSelectionModel({singleSelect:true}),
bbar:new Ext.PagingToolbar({
pageSize:10,
store:store,
displayInfo:true,
displayMsg:'显示第{0}条到{1}条记录,一共{2}条记录',
emptyMsg:'没有记录'
})
});
var view = new Ext.Viewport({
layout:'fit',
items:[
grid
]
});
});
./../../employee/findAll.action 是我用struts2写得一个action,action动态生成的就是一个xml。
xml的编码和页面编码都是utf-8,路径也没写有错。于是我干脆就把xml的内容复制好,放到新建的一个xml的文件中,在去用extjs去解析这个,结果是IE和firefox都可以解析。难道extjs不能IE支持的动态xml解析嘛?
xml内容如下(./../../employee/findAll.action打印内容):
<dataset>
<total>20</total>
<line>
<col1>data1_0</col1>
<col2>data2_0</col2>
<col3>data3_0</col3>
<col4>data4_0</col4>
</line>
..........
</dataset>

被折叠的 条评论
为什么被折叠?



