我不能修改数据x的格式,请教后面的extjs表格应该怎么些?
貌似是因为我不懂jason的缘故。
<script>
/*
* Ext JS Library 2.3.0
* Copyright(c) 2006-2009, Ext JS, LLC.
* licensing@extjs.com
*
*
http://extjs.com/license */
Ext.onReady(function(){
var x = [
{"users":{"id":"1","name":"bud","email":"bud@huoyan.com","username":"bud","passwd":"6539f4370fd54db03043ae6eea13c0e8","created":"2010-07-23 15:24:36"}},
{"users":{"id":"2","name":"bud","email":"dfd@gmail.com","username":"yy","passwd":"8fad04b57fa978a161274d0b7c3df108","created":"2010-07-23 15:29:34"}}
];
// create the data store
var store = new Ext.data.SimpleStore({
fields: [
{name: 'users.id'},
{name: 'users.name', },
{name: 'users.email', },
{name: 'users.username', },
{name: 'users.password', },
{name: 'users.created' },
]
});
store.loadData(x);
// create the Grid
var grid = new Ext.grid.GridPanel({
store: store,
columns: [
{id:'users.id',header: "id", width: 160, sortable: true, dataIndex: 'users.id'},
{header: "name", width: 75, sortable: true, dataIndex: 'users.name'},
{header: "email", width: 75, sortable: true, dataIndex: 'users.email'},
{header: "username", width: 75, sortable: true, dataIndex: 'users.username'},
{header: "password", width: 85, sortable: true, dataIndex: 'users.password'},
{header: "created", width: 85, sortable: true, dataIndex: 'users.created'}
],
stripeRows: true,
autoExpandColumn: 'users.id',
height:350,
width:600,
title:'Array Grid'
});
grid.render('grid-example');
});
</script>
<div id="grid-example"></div>
--
FROM 124.126.202.*