JSF怎样把JSON传给EXTJS GRID?

a_lgz 2008-06-18
JSF怎样把JSON传给EXTJS GRID?最好举个小例子.
alrece 2008-06-18
直接load就可以了
commond 2008-06-24
var store=new Ext.data.JsonStore({
        url:'test.json',
		autoLoad:true,
		fields:['id','text','cls']
		
    });
//store.filter( 'text', 'TT', true ) ;
store.load({params :{text :'CTS'}});


MessageGrid=function(){
		alert('MessageGrid');
        MessageGrid.superclass.constructor.call(this, {
        store: store,
        columns: [
            {header: "ID", width: 90, sortable: true, dataIndex: 'id'},
            {header: "Name", width: 90, sortable: true, dataIndex: 'text'},
            {header: "CLS", width: 75, sortable: true,  dataIndex: 'cls'}
            
        ]
        
    }
														);
				}

Ext.extend(MessageGrid, Ext.grid.GridPanel);
equalto 2008-06-24
问题有点怪,不知道是不是说java数据怎么转发到前台页面上来.

如果是这样的话,可以使用JSON的java支持,在json.org上可以下载,它可以进行json数据的序列化和反序列化,举例:
JSONObject jobj = new JSONObject();
jobj.put("a", true);

这个jobj.toString()就是字符串(两天的引号省略了)
{"a":true}
这样的结果,直接用标签在jsp页面上输出,应该可以满足要求了.
guojbin 2008-09-02
如果url得到的數據,在服務端需要1分钟的处理,像这种情况,數據好像会得不到的子,需要設置什麽呢?


commond 写道
var store=new Ext.data.JsonStore({
        url:'test.json',
		autoLoad:true,
		fields:['id','text','cls']
		
    });
//store.filter( 'text', 'TT', true ) ;
store.load({params :{text :'CTS'}});


MessageGrid=function(){
		alert('MessageGrid');
        MessageGrid.superclass.constructor.call(this, {
        store: store,
        columns: [
            {header: "ID", width: 90, sortable: true, dataIndex: 'id'},
            {header: "Name", width: 90, sortable: true, dataIndex: 'text'},
            {header: "CLS", width: 75, sortable: true,  dataIndex: 'cls'}
            
        ]
        
    }
														);
				}

Ext.extend(MessageGrid, Ext.grid.GridPanel);

Global site tag (gtag.js) - Google Analytics