日期:2014-05-16 浏览次数:20804 次
success:function(response){
   var json = eval("(" + response.responseText + ")");
}
------解决方案--------------------
看错了 是往服务端提交撒
往服务端提交有好几种方式 楼主是哪种提交 formPanel的 还是Ajax的?服务端语言是什么?
------解决方案--------------------
服务端还不就是一个字符串呀。当然如果你用其它框架的话,框架会帮你转化。
------解决方案--------------------
json 数据一般分为 数组 或者对象 在ext控件支持的json数据格式也不完全相同 不多废话给几个例子看看
我是通过json-plugin包来返回json数据的
json数据:
[JSON]{"message":null,"phone":"","smartUserList":[{"orderType":"按使用次数","regDate":"2011-05-25T14:30:11","smartType":"普通卡","usPhone":"13810351401","usType":"全球通\/动感地带"},{"orderType":"按使用次数","regDate":"2011-05-25T00:00:00","smartType":"普通卡","usPhone":"861381000","usType":"全球通\/动感地带"}],"success":true}
grid 会用到其中
"smartUserList":[{"orderType":"按使用次数","regDate":"2011-05-25T14:30:11","smartType":"普通卡","usPhone":"13810351401","usType":"全球通\/动感地带"},{"orderType":"按使用次数","regDate":"2011-05-25T00:00:00","smartType":"普通卡","usPhone":"861381000","usType":"全球通\/动感地带"}]
部分
js代码
给出gird部分
//start  grid-people  
					var sm = new Ext.grid.CheckboxSelectionModel();
					var cm = new Ext.grid.ColumnModel( [
					        new Ext.grid.RowNumberer(),  
					        sm ,		
					        {
								header : '用户号码',
								dataIndex : 'usPhone'
							},  {
								header : '用户类型',
								dataIndex : 'usType'
							},  {
								header : '业务类型',
								dataIndex : 'smartType'
							},  {
								header : '排序规则',
								dataIndex : 'orderType'
							}, {
								header : '注册时间',							
								dataIndex : 'regDate',
								width : 120,
								renderer : Ext.util.Format.dateRenderer('Y-m-d H:i:s')
							}			
							]);
							
					var ds = new Ext.data.Store({
  				 		proxy: new Ext.data.HttpProxy({url:'selectSmartUser.action'}),    	
					    reader: new Ext.data.JsonReader({
						    totalProperty: 'totalProperty',
						    root: 'smartUserList'
						}, [		  
								{name : 'usPhone',mapping:'usPhone',type : 'string'},  
								{name : 'regDate',mapping:'regDate',type : 'date',dateFormat : 'Y-m-dTH:i:s'},
								{name : 'usType',mapping:'usType',type : 'string'},
								{name : 'smartType',mapping:'smartType',type : 'string'},
								{name : 'orderType',mapping:'orderType',type : 'string'}
								
						]),
						baseParams:{uname : '' , mname : '' , typename : '',action : '', startfcd : '', endfcd : ''}  
					});
                       			
					var grid = new Ext.grid.GridPanel({	
					    loadMask : {
						    msg : '列表加载中...'
					    },
					    id : 'grid',	
					    title : '用户信息',		   
					    region : 'center',
					    height : 120,
					    ds: ds,
					    cm: cm,
					    sm: sm,
					    listeners : {
						    'rowdblclick' : onRowDblClick, //双击				   
						    scope : this
					    }		    	   
					});									
//grid-people end
------解决方案--------------------