页面结果图
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/6150b1a9697ab890ea1a651f790ccc7e.png)
$("#project_dg").datagrid({
url: '/ESEasyUi/projectController/queryProjectByPage',
remoteSort: false,
sortName: "projectPrice",
sortOrder: "desc",
method: "get",
fitColumns: true,
striped: true,
pagination: true,
rownumbers: false,
singleSelect: true,
ctrlSelect: true,
pageSize: 10,
pageList: [3, 5, 10, 20],
queryParams: {
projectName: $("#projectNameBox").val(),
affiliatedUnit: $("#affiliatedUnitBox").val(),
projectId: $("#projectIdBox").val(),
buildNature: $("#buildNatureBox").val(),
projectTime: $("#projectTimeBox").val()
},
onLoadSuccess: function (data) {
var project = {
"affiliatedUnit": $("#affiliatedUnitBox").val(),
"projectId": $("#projectIdBox").val(),
"projectName": $("#projectNameBox").val(),
"buildNature": $("#buildNatureBox").val(),
"projectTime": $("#projectTimeBox").val()
};
$.ajax({
dataType: "json",
type: "POST",
contentType: "application/json",
data: JSON.stringify(project),
url: "/ESEasyUi/projectController/queryTotalSum",
success: function (list) {
console.log(list);
$("#project_dg").datagrid('insertRow', {
index: 0,
row: {
projectName: '汇总',
affiliatedUnit: "",
projectId: "",
buildNature: "",
projectPrice: list
}
});
},
});
data.total = data.total - 1;
},
rowStyler: function (index, row) {
if (row.projectName == "汇总") {
return "background-color:Yellow;";
}
},
columns: [[
{field: 'projectName', title: '项目名称', width: "20%", align: "center"},
{field: 'affiliatedUnit', title: '所属单位', width: "20%", align: "center"},
{field: 'projectId', title: '项目编码', width: "20%", align: "center"},
{field: 'buildNature', title: '建设性质', width: "20%", align: "center"},
{
field: 'projectPrice', title: '总计划值', width: "20%", align: "center",
sortable: true,
formatter: function (v) {
return parseFloat(v).toFixed(2)
}
}
]]
});