日期:2014-05-16  浏览次数:20398 次

ExtJs TreeGrid实例
var searchRstGridPanel = new Ext.grid.GridPanel ({
				 store: new Ext.data.Store({ 
			        
			        proxy: new Ext.data.HttpProxy({
			            url: searchNodeFromLuceneDataUrl
			        }),  // 必须是 HttpProxy
			        
			        reader:new Ext.data.JsonReader({
			        	totalProperty: 'totalCount',
	       				idProperty:'nodeId',
	       				root:'data',
	       				remoteSort: true,
	       				
	       				fields: [
			            	'nodeId','nodeName', 'nodeType', 'path'			            
			       		]
			        })
			    }),

			    colModel: new Ext.grid.ColumnModel({
			        defaults: {
			            width: 120,
			            sortable: true
			        },
			        columns: [
			            {id: 'nodeId', header: '序号', width: 200, sortable: true, dataIndex: 'nodeId'},
			            {header: '节点类型', dataIndex: 'nodeType'},
			            {header: '节点名称', dataIndex: 'nodeName'},
			            {header: '路径', dataIndex: 'path'}
			        ]
			    }),
			    viewConfig: {
			        forceFit: true,
			
			//      Return CSS class to apply to rows depending upon data values
			        getRowClass: function(record, index) {
			           
			        }
			    },
			    anchor:'100% 300',
			    frame: true,
			    border:false,
			    iconCls: 'icon-grid'
			});

json字符串:
{success:true,'totalCount':'2',data:[{'nodeId':'2c9090652fb50c67012fb51609720002','nodeType':'nd:base','nodeName':'电视剧','path':'mas'},{'nodeId':'2c9090652fb50c67012fb51a64070005','nodeType':'nd:vod','nodeName':'come','path':'mas/mas'}]}