论坛首页 Web前端技术论坛

用Ext提交了form以后`返回的json怎么放到grid里去??

浏览 2829 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2008-01-09  
formByZfzh.form.doAction('submit', {   
                     url : 'Search.do',   
                     method : 'get',   
                     params : '',   
                     success : function(form, action) {  
                         }
                         .................. 


这里返回的action个什么类型的?

我返回的json数据是这样的``

引用
{"count":1,"dwChooser":"","name":"","xqChooser":null,"zjz":[{"dwName":"行政执法局","name":"张三","zfgw":null,"zfzh":"A-0010001"}],"zfzh":"A-0010001"}


我应该怎么写才把他放到GRID里去??
   发表时间:2008-01-09  
	function addTab(){
	   formByZfzh.form.doAction('submit', {   
                     url : 'Search.do',   
                     method : 'get',   
                         success : function(form, action) {   
                             tabs.add(
                                new Ext.grid.GridPanel({
                                     iconCls: 'tabs',
                                     region: 'center',
                                     store: new Ext.data.Store({
                                          proxy: new Ext.data.MemoryProxy(action.result),
                                          reader: new Ext.data.JsonReader({
                                              root: 'zjz',
                                          }, [
                                              {name: 'name', mapping: 'name'},
                                              {name: 'zfzh', mapping: 'zfzh'},
                                              {name: 'dwName', mapping: 'dwName'}, 
                                              {name: 'zfgw', mapping: 'zfgw'}
                                          ])
  
                                      }),
                                     cm: cm,
                                     closable: true,
                                     stripeRows: true,
                                     height:350,
                                     width:700,
                                     title:'查询结果',
                                     bbar: new Ext.PagingToolbar({
                                         pageSize: 25,
                                         store: store,
                                         displayInfo: true,
                                         displayMsg: 'Displaying topics {0} - {1} of {2}',
                                         emptyMsg: "No topics to display",
                                         items:[
                                             '-', {
                                             pressed: true,
                                             enableToggle:true,
                                             text: 'Show Preview',
                                             cls: 'x-btn-text-icon details',
                                             toggleHandler: toggleDetails
                                         }]
                                     })
                                  })
                              ).show();   
                         },   
                         failure : function(form, action) {   
                             Ext.Msg.alert('警告', '输入错误!');   
                            }
                 });    
    }


我是这样实现的```GRID能出来``列名什么的都对`就是没有数据```
0 请登录后投票
   发表时间:2008-01-11  
mvc架构当然要把数据放在m中
重新构造model并付给grid就ok
0 请登录后投票
论坛首页 Web前端技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics