gridpanel之三简单小例子

<script type="text/javascript">
Ext.onReady(function(){
    //定义一个一维数组
    var data = [
    {id:1,A:'a',B:'b',C:'c'},
    {id:2,A:'d',B:'e',C:'f'},
    {id:3,A:'g',B:'h',C:'i'},
    {id:4,A:'j',B:'k',C:'l'}];
    //用JsonStore定义数据源
    var store = new Ext.data.JsonStore({data:data,fields:['id','A','B','C']});
    //创建三个列及列的标题
    var colM = new Ext.grid.ColumnModel([
    {header:'id',dataIndex:'id',sortable:true},
    {header:'what',dataIndex:'A',sortable:true},
    {header:'where',dataIndex:'B',sortable:true},
    {header:'how',dataIndex:'C',sortable:true}]);
    var grid = new Ext.grid.GridPanel({
        renderTo:'hello',
        title:'haha',
        width:400,
        height:200,
        cm:colM,
        store:store
       
    });
});
</script>
</head>
  <body>
    <div id="hello"></div>
</body>
</html>

你可能感兴趣的:(C++,c,C#,F#,ext)