Ext.onReady(function() {
var ds = new Ext.data.Store( {
proxy : new Ext.data.HttpProxy( {
url : 'Login!hellogrid.action'
}),// 调用的动作
reader : new Ext.data.JsonReader( {
root : 'user', // 从struts2里面传递过来的参数
successProperty : 'success'
}, [ // JSON数据的映射
{
name : 'id',
mapping : 'id',
type : 'string'
}, {
name : 'fullName',
mapping : 'username',
type : 'string'
}, {
name : 'email',
mapping : 'email',
type : 'string'
}, ])
});
var grid = new Ext.grid.GridPanel( {
id : "grid",
el : "example-grid",
ds : ds,
store : ds,
columns : [ {
header : "id",
width : 120,
dataIndex : 'id',
sortable : true
}, {
header : "usrName",
width : 120,
dataIndex : 'fullName',
sortable : true
}, {
header : "email",
width : 120,
dataIndex : 'email',
renderer : showUrl(this.value)
} // 显示超链接
],
width : 360,
height : 600
});
grid.render();
ds.load();
});
function showUrl(value) {
return "<a href='mailto:" + value + "'>value</a>";
}
ext grid load
最新推荐文章于 2020-12-19 10:42:15 发布