EXT.GRID JOSN

[TEST.ASP]

<html>
<head>
<title>CSS Example</title>
 <link rel="stylesheet" type="text/css" href="ext2.1/resources/css/ext-all.css" />
 <script type="text/javascript" src="ext2.1/adapter/ext/ext-base.js"></script>
 <script type="text/javascript" src="ext2.1/ext-all.js"></script>
 <script type="text/javascript" src="js.js"></script>
<script>
 Ext.onReady(function(){
  
    Ext.QuickTips.init();
    var sm = new Ext.grid.CheckboxSelectionModel();
    var cm = new Ext.grid.ColumnModel([
        new Ext.grid.RowNumberer(),
        sm,
        {header:'bh',dataIndex:'id',sortable:true},
        {header:'mc',dataIndex:'name'},
        {header:'ms',dataIndex:'descn'}
    ]);
   
    //
    var ds = new Ext.data.Store({
        proxy: new Ext.data.HttpProxy({url:'TEST.ASP'}),       
        reader: new Ext.data.JsonReader({
            totalProperty: 'totalProperty',
            root: 'root',
            successProperty :'success'
        }, [
            {name: 'id',mapping:'id',type:'int'},
            {name: 'name',mapping:'name',type:'string'},
            {name: 'descn',mapping:'descn',type:'string'}
        ])
    });

   
    var grid = new Ext.grid.GridPanel({
        el: 'grid3',
        ds: ds,
        sm: sm,
        cm: cm,
        width:700,
        height:280,
        bbar: new Ext.PagingToolbar({
            pageSize: 10,
            store: ds,
            displayInfo: true,
            displayMsg: '顯示 {0} 條到 {1}條記錄,一共 {2} 條',
            emptyMsg: "沒有記錄"
        })
    });
   
    grid.render();
    ds.load({params:{start:0, limit:10}});
});

</script>
</head>

<body>
  
 <div id="grid3" style="width: 100%;height: 100%"></div>
</body>
</html>

 

[TEST.ASP]        

<%
   
    json = "{totalProperty:10,root:["
    for i = 0 TO 10
        json =json& "{id:" & i & ",name:'name" & i & "',descn:'descn" & i & "'}"
        if i <> 10 THEN
            json =json& ","
     end if
       
     NEXT
    json =json&"]}"
    response.write(json)

%>

 

 

 

你可能感兴趣的:(grid)