話不多說,先上代碼:
這時綁定數據
table.render({
elem: '#table-data',
//, id: 'roleId' //要隱藏的列名
url: 'GetList', // 請求的數據地址
id: 'testReload',
toolbar: '#table-data-toolbar',
title: "軟件管理",
page: true,
limit: 10,
cols: [
[
{ type: "checkbox", width: 50, fixed: "left" },
{ field: 'aid', title: '編號', width: 80, fixed: 'left', sort: true },
{ field: 'appId', title: '軟件加密', width: 80 },
{ field: 'softwareName', title: '軟件名', width: 200 },
{ field: 'version', title: '版本', width: 130 },
{ field: 'registered', title: '注冊數量', width: 100 },
{ field: 'try', title: '試用數量', width: 120 },
{
field: 'isEnable',
title: '是否啟用',
width: 110,
templet: '#chbox-isEnable',
unresize: true
},
{ filed: 'createTime', title: '創建時間', width: 120 },
{ fixed: 'right', title: '操作', toolbar: '#table-data-tool', width: 150 }
]
]
});
這時重載數據:
$('#searchList').on('click', function () {
var name = $('#softName');
var softId = $('#softId');
var userName = $('#userName');
console.log(name.val());
table.reload('testReload', {
url:'GetList',
page: {curr:1},
where: {
softName: name.val(),
userName: userName.val(),
softId: softId.val()
}
},'data')
})
where:{里面的值是傳到后台的值,有點像鍵值對形式}
后台代碼:
傳進來做相應的判斷就好了,怎么顯示出去