easyui datagrid 在页面上不显示数据 100
js:$(function(){$('#test').datagrid({title:'MyTitle',//表格标题iconCls:'icon-save',//表格图标...
js:
$(function(){ $('#test').datagrid({ title:'My Title',//表格标题 iconCls:'icon-save',//表格图标 nowrap: false,//是否只显示一行,即文本过多是否省略部分。 striped: true, url:'userListAction', //action地址 frozenColumns:[[ ]], columns:[[ {field:'itemid',title:'itemid',width:150}, {field:'productid',title:'productid',width:120} ]], pagination:true, //包含分页 rownumbers:true, singleSelect:true
}); });
</script>
struts2配置:
<package name="json" extends="json-default"> <action name="userListAction" class="com.automobile.action.UserAction" method="getUserAllList"> <result name="success" type="json"> <param name="root" >resultObject</param> </result> </action> </package>
action:
public String getUserAllList(){ Map map = new HashMap(); List listMap = new ArrayList(); for (int i = 0; i < 3; i++) { Map<String,String> m =new HashMap(); m.put("itemid",i+"item"); m.put("productid","productid"+i); listMap.add(m); } map.put("total", 3); map.put("rows", listMap); resultObject = JSONArray.fromObject(map); System.out.println(resultObject); return SUCCESS; }
输出的json:[{"total":3,"rows":[{"productid":"productid0","itemid":"0item"},{"productid":"productid1","itemid":"1item"},{"productid":"productid2","itemid":"2item"}]}] 展开
$(function(){ $('#test').datagrid({ title:'My Title',//表格标题 iconCls:'icon-save',//表格图标 nowrap: false,//是否只显示一行,即文本过多是否省略部分。 striped: true, url:'userListAction', //action地址 frozenColumns:[[ ]], columns:[[ {field:'itemid',title:'itemid',width:150}, {field:'productid',title:'productid',width:120} ]], pagination:true, //包含分页 rownumbers:true, singleSelect:true
}); });
</script>
struts2配置:
<package name="json" extends="json-default"> <action name="userListAction" class="com.automobile.action.UserAction" method="getUserAllList"> <result name="success" type="json"> <param name="root" >resultObject</param> </result> </action> </package>
action:
public String getUserAllList(){ Map map = new HashMap(); List listMap = new ArrayList(); for (int i = 0; i < 3; i++) { Map<String,String> m =new HashMap(); m.put("itemid",i+"item"); m.put("productid","productid"+i); listMap.add(m); } map.put("total", 3); map.put("rows", listMap); resultObject = JSONArray.fromObject(map); System.out.println(resultObject); return SUCCESS; }
输出的json:[{"total":3,"rows":[{"productid":"productid0","itemid":"0item"},{"productid":"productid1","itemid":"1item"},{"productid":"productid2","itemid":"2item"}]}] 展开
1个回答
展开全部
var width = $(window).width()-80;
var height = $(window).height()-120;
stView_layout = $('#stView_layout').layout({
width: width,
height: height
});
station_view = $('#stationView').window({
title: '测站导航',
left:50,
top:80,
width: width,
modal: false,
shadow: false,
closed: true,
height: height,
onResize:function(w,h){
if(stView_treegrid){
stView_treegrid.treegrid({
width:w-20,
height:h-260
});
}
}
});
var height = $(window).height()-120;
stView_layout = $('#stView_layout').layout({
width: width,
height: height
});
station_view = $('#stationView').window({
title: '测站导航',
left:50,
top:80,
width: width,
modal: false,
shadow: false,
closed: true,
height: height,
onResize:function(w,h){
if(stView_treegrid){
stView_treegrid.treegrid({
width:w-20,
height:h-260
});
}
}
});
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询