首页 > 代码库 > datagrid中动态url
datagrid中动态url
function showDTbyid(id) {
initTablListDP();
$(‘#tbwest‘).datagrid({
url: ‘/SuitAdd/ShowDTbyid/‘+id 把url中抽出来
});
}
function initTablListDP() {
$(‘#tbwest‘).datagrid({
//url: ‘/SuitAdd/ShowDTbyid/‘+id
title: ‘‘,
width: 500,
height: 320,
fitColumns: true, //列自适应
idField: ‘id‘, //主键列的列明
loadMsg: ‘正在加载用户的信息...‘, //展示着行字
pagination: false, //是否有分页
singleSelect: true , //是否单行选择
pageSize: 10, //页大小,一页多少条数据
pageNumber: 1, //当前页,默认的
//pageList: [10, 20, 30], //
// queryParams: params, //往后台传递参数
columns: [[
{ field: ‘spid‘, title: ‘商品ID‘, width: 80 },
{ field: ‘spdm‘, title: ‘商品‘, width: 90 },
{ field: ‘spmc‘, title: ‘商品名称‘, width: 90 },
{ field: ‘ysid‘, title: ‘颜色ID‘, hidden: true },
{ field: ‘ysdm‘, title: ‘颜色代码‘, width: 80 },
{ field: ‘ysmc‘, title: ‘颜色名称‘, width: 90 },
{ field: ‘id‘, title: ‘删除‘, width: 30, formatter: function (value, row, index) {
var d = ‘<a href="http://www.mamicode.com/#" onclick =DeleteByIdDP("‘ + row.id + ‘")><img src="http://www.mamicode.com/Images/delete.png" /></a>‘;
return d;
} }
]],
onHeaderContextMenu: function (e, field) {
}
});
} //初始化选择表格