当前位置 : 主页 > 网页制作 > Dojo >

DOJO遍历DataGrid数据并转换成json格式数据

来源:互联网 收集:自由互联 发布时间:2021-06-15
var length = grid.store._arrayOfAllItems.length;//循环遍历合同信息,并修改合同信息(修改状态、支数和重量)for(var i = 0;ilength;i++){//取得主键 var id = grid.store.getValue(grid.getItem(i),"id");//取得合同信息
 
		var  length = grid.store._arrayOfAllItems.length;	
					//循环遍历合同信息,并修改合同信息(修改状态、支数和重量)
						for(var i = 0;i<length;i++){
							//取得主键
							 var id = grid.store.getValue(grid.getItem(i),"id");
							//取得合同信息
							 var  conId = grid.store.getValue(grid.getItem(i),"constractId");
							 var  materialNumber = grid.store.getValue(grid.getItem(i),"materialNumber");
							 var materialWeight  = grid.store.getValue(grid.getItem(i),"materialWeight");
							 var contract ='{"id":"'+id+'","constractId":"'+conId+'","materialNumber":"'+materialNumber+'","materialWeight":"'+materialWeight+'"}';
							//将合同转换为object对象
							 var strObj =  Json.parse(contract, true);
							//将object转换为json对象
							var strJson = Json.stringify(strObj);
网友评论