easyUI使用datagrid(通过url从后台取数据)

代码可直接复用

var machineGrid;//网格定义
var url = PATH.BASEPATH+'/omPlatform/cluster/getSecondCatalog?userName='+userName1+'&upPath='+upPath1+'&times='+secondTimes1;
$(function(){
	getDateGrid();
});
/**
* 载入数据
*/
function getDateGrid(){
if(machineGrid){ //如果网格存在优先加载网格
    machineGrid.datagrid('load',{
        clusterId:clusterId//过滤参数
    });
    return;
}
machineGrid = $('#datagridDiv').datagrid({
	url:url,
	method:'post',
	loadMsg : '正在加载数据...',
	rownumbers:false,//序列号
	nowrap:true,
	pageSize:10, 
	striped:true,//行条纹化
	pagination:false,//分页工具
	pagePosition:'bottom',//分页栏位置
	fitColumns:true,//宽度自适应
	fit:true,//高度自适应
        queryParams : {  //url所携带的查询参数
            clusterId:clusterId
        },
	columns:[[{ 
		field : 'hdfsPath',
	    title : '名称',
	    width : 200,
	    align : 'center'
	}, {
	    field : 'times',
	    title : '修改日期',
	    width : 200,
	    align : 'center'
	}, {
	    field : 'pub',
	    title : '类型',
	    width : 100,
	    align : 'center'
	}, {
	    field : 'allocatedMb',
	    title : '大小(G)',
	    width : 100,
	    align : 'center'
	}]]
});    
}

知识点:

(1)url是controller中的url,method为post,controller中也为method=RequestMethod.POST ;

(2)columns中的field必须和后台拿到的json数据字段名一样,否则无法匹配;

 

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值