通过easyui实现动态控制表格字段显示、导出表格数据

news2024/12/28 23:16:52

前言

学过layui前端框架的都知道,layui默认帮我们实现了控制表格字段显示以及数据的导出功能。

1、控制表格字段显示

2、数据导出

3、导出为pdf:导出按钮的右边那个按钮就是打印pdf的

那么,easyui要怎么实现这些功能呢?这篇文章就要介绍一下怎么通过前端实现表格数据导出以及控制字段显示的效果。

一、easyui数据导出

其实和layui一样,easyui已经帮我们实现了数据导出的功能,不过需要额外引入 datagrid-export.js 这个JS文件。

如图,把 datagrid-export.js 下载到本地,复制到springboot项目的 resources/static/js/easyui 目录下,然后在页面引入。

 然后通过一句代码就可以完成表格数据的导出

$(表格的选择器).datagrid("toExcel", 导出的文件名);

例如:

$('#member_list').datagrid("toExcel", "帮派成员.xls");

在这里贴出已经实现了导出功能的页面代码

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<link rel="stylesheet" href="/css/themes/icon.css"/>
		<link rel="stylesheet" href="/css/themes/default/easyui.css" />
		<title>帮派管理>>帮派成员列表</title>
		<script src="/js/public/jquery.min.js"></script>
		<script src="/js/easyui/jquery.easyui.min.js"></script>
		<script src="/js/easyui/datagrid-export.js"></script>
		<script src="/js/easyui/easyui-lang-zh_CN.js"></script>
	</head>
	
	<body>
		<form id="form">
			<table style="border-spacing:5px;">
				<tr>
					<td><input id="gang_id" /></td>
					<td><input id="_name_" /></td>
					<td><input id="job_id" /></td>
					<td><input id="role_id" /></td>
					<td><input id="school_id" /></td>

					<td><a id="search">搜索</a></td>
					<td><a id="clear">清空</a></td>
				</tr>
			</table>
		</form>

		<div id="member_dialog" style="display:none;">
			<form id="member_form">
				<table style="border-spacing:5px;">
					<tr>
						<td>成员ID</td>
						<td><input id="id" name="id" /></td>
						
						<td>昵&emsp;&emsp;称</td>
						<td><input id="name" name="name" /></td>

						<td>等&emsp;&emsp;级</td>
						<td><input id="grade" name="grade" /></td>
					</tr>
					
					<tr>
						<td>门&emsp;&emsp;派</td>
						<td><input id="schoolId" name="schoolId" /></td>
						
						<td>角色造型</td>
						<td><input id="roleId" name="roleId" /></td>
					</tr>

					<tr>
						<td>本周帮贡</td>
						<td><input id="thisWeek" name="thisWeek" /></td>

						<td>现有帮贡</td>
						<td><input id="current" name="current" /></td>
						
						<td>历史帮贡</td>
						<td><input id="history" name="history" /></td>
					</tr>

					<tr>
						<td>所属帮派</td>
						<td><input id="gangId" name="gangId" /></td>

						<td>担任职务</td>
						<td><input id="jobId" name="jobId" /></td>
					</tr>
				</table>

				<table style="border-spacing:5px;">
					<tr>
						<td>入帮时间</td>
						<td><input id="enterTime" name="enterTime" /></td>
						
						<td>离线时间</td>
						<td><input id="lastOnline" name="lastOnline" /></td>
					</tr>
				</table>
			</form>
		</div>
		
		<table id="member_list"></table>

		<script src="/js/public/util.js"></script>
		<script src="/js/public/public.js"></script>
		<script src="/js/gang/gang_member_list.js"></script>
	</body>
</html>
let requestUrl;
let height = 550;
let image_size = 40;

function addHandler() {
	let gangId = $("#gang_id").combobox("getValue");

	if (gangId) {
		$("#gangId").combobox("setValue", gangId);
	}

	requestUrl = "/gang_member/insert";

	$("#member_dialog").dialog("open");
}

function editHandler() {
	let rowData = $("#member_list").datagrid("getSelected");
	
	if (rowData) {
		requestUrl = "/gang_member/updateById";

		$("#id").textbox("setValue", rowData.id);
		$("#name").textbox("setValue", rowData.name);
		$("#jobId").combobox("setValue", rowData.jobId);
		$("#gangId").combobox("setValue", rowData.gangId);
		$("#roleId").combobox("setValue", rowData.roleId);
		$("#grade").numberspinner("setValue", rowData.grade);
		$("#schoolId").combobox("setValue", rowData.schoolId);
		$("#current").numberspinner("setValue", rowData.current);
		$("#history").numberspinner("setValue", rowData.history);
		$('#enterTime').datebox("setValue", rowData.enterTime);
		$('#lastOnline').datebox("setValue", rowData.lastOnline);
		$("#thisWeek").numberspinner("setValue", rowData.thisWeek);

		$("#member_dialog").dialog("open");
	} else {
		alertMsg("请选择要修改的记录!", "warning");
	}
}

function deleteHandler() {
	let rowData = $("#member_list").datagrid("getSelected");
	
	if (rowData) {
		$.messager.confirm('系统提示', '是否确认删除该帮派成员?', function(bool) {
			if (bool) {
				get("/gang_member/deleteById", {
					id: rowData.id
				}, function(response) {
					showMsg(response.message);

					$("#member_list").datagrid("reload");
				}, error);
			}
		});
	} else {
		alertMsg("请选择要删除的记录!", "warning");
	}
}

/**
 * 保存为pdf需要提供此方法
 */
function toPdf() {
	let body = $("#member_list").datagrid("toArray");

	let docDefinition = {
		content: [{
			table: {
				body: body,
				headerRows: 1,
				widths: ["*", "*", "*", "*", "auto", "*"]
			}
		}]
	};

	pdfMake.createPdf(docDefinition).open();
}

$(document).ready(function() {
	// 帮派
	$("#gang_id").combobox({
		url: "/gang/selectAll",
		valueField: "id",
		textField: "name",
		width: 150,
		panelHeight: "auto",
		prompt: "-选择帮派-"
	});

	// 角色名
	$("#_name_").textbox({
		width: 150,
		prompt: "输入角色名模糊查询"
	});

	$("#job_id").combobox({
		url: "/gang_job/selectAll",
		valueField: "id",
		textField: "name",
		width: 150,
		panelHeight: "auto",
		prompt: "输入帮派职务"
	});

	// 门派
	$("#school_id").combobox({
		url: "/school/selectAll",
		valueField: "id",
		textField: "name",
		width: 150,
		prompt: "-选择门派-",
		panelHeight: "auto",
		formatter: function(row) {
			return "<img width='20' src='" + row.image + "' />&nbsp;" + row.name;
		}
	});

	// 角色造型
	$("#role_id").combobox({
		url: "/role_modeling/selectAll",
		valueField: "id",
		textField: "name",
		width: 150,
		panelHeight: "auto",
		groupField: "phyle",
		prompt: "-请选择角色造型-",
		groupFormatter: function(group) {
			get("/phyle/selectById", {
				id: group
			}, function (res) {
				$("#_phyle_" + group).html(res.name);
			}, error);

			return "<span class='blue' id='_phyle_" + group + "'></span>";
		},
		formatter: function(row) {
			return "<img width='20' src='" + row.image + "' />&nbsp;" + row.name;
		}
	});

	// 搜索按钮
	$("#search").linkbutton({
		iconCls: "icon-search"
	}).click(function() {
		let name = $("#_name_").textbox("getValue");
		let jobId = $("#job_id").combobox("getValue");
		let roleId = $("#role_id").combobox("getValue");
		let gangId = $("#gang_id").combobox("getValue");
		let schoolId = $("#school_id").combobox("getValue");

		$("#member_list").datagrid('load', {
			name: name,
			jobId: jobId,
			roleId: roleId,
			gangId: gangId,
			schoolId: schoolId
		});
	});

	// 清空按钮
	$("#clear").linkbutton({
		iconCls: "icon-delete"
	}).click(function() {
		$("#form").form("clear");
	});



	$("#id").textbox({
		width: 100,
		required: true
	});
	
	$("#name").textbox({
		width: 100,
		required: true
	});
	
	$("#schoolId").combobox({
        url: "/school/selectAll",
		valueField: "id",
		textField: "name",
		width: 100,
		required: true,
		panelHeight: "auto",
		formatter: function(row) {
			return "<img width='20' src='" + row.image + "' />&nbsp;" + row.name;
		},
		onSelect: function(record){
	        if(record) {
	        	let url = "/role_modeling/selectByPhyle?phyle=" + record.phyle;

	        	$('#roleId').combobox("reload", url);
	        }
	    }
	});
	
	$("#roleId").combobox({
        url: "/role_modeling/selectAll",
        valueField: "id",
		textField: "name",
		width: 100,
		required: true,
		panelHeight: "auto",
		formatter: function(row) {
			get("/role_modeling/selectImageById", {
				id: row.id
			}, function(response) {
				$("#_modeling_" + row.id).attr("src", response.data);
			}, error);
			
			return "<img width='20' id='_modeling_" + row.id + "' />&nbsp;" + row.name;
		}
    });
	
	$("#grade").numberspinner({
        min: 0,
        width: 100,
        max: 115,
        editable: true,
        required: true
    });
	
	$("#jobId").combobox({
        url: "/gang_job/selectAll",
        valueField: "id",
		textField: "name",
		width: 100,
		required: true,
		panelHeight: "auto"
	});
	
    $("#thisWeek").numberspinner({
        min: 0,
        width: 100,
        required: true
    });
    
    $("#current").numberspinner({
        min: 0,
        width: 100,
        required: true
    });
    
    $("#history").numberspinner({
        min: 0,
        width: 100,
        required: true
    });

	$("#gangId").combobox({
		url: "/gang/selectAll",
		valueField: "id",
		textField: "name",
		width: 100,
		required: true,
		panelHeight: "auto"
	});
    
    $("#enterTime").datebox({
    	width: 185,
        required: true
    });
    
    $("#lastOnline").datebox({
    	width: 185,
        required: true
    });
    
	$("#member_dialog").dialog({
		title: "成员信息",
		modal: true,
		closed: true,
		closable: true,
		draggable: false,
		buttons: [{
			iconCls: "icon-save",
			text: "保存",
			handler: function() {
				let selector = "#member_form";

				checkForm(selector, function () {
					let data = $(selector).serialize();

					post(requestUrl, data, function(response) {
						showMsg(response.message);

						$(selector).form("clear");
						$("#member_dialog").dialog("close");
						$("#member_list").datagrid("close");
					}, error);
				});
			}
		}, {
			iconCls: "icon-cancel",
			text: "取消",
			handler: function() {
				$("#member_dialog").dialog("close");
				$("#member_form").form("clear");
			}
		}]
	});
	
	$("#member_list").datagrid({
		url: "/gang_member/selectByPage",
		striped: true,
		height: height,
		multiSort: true,
		remoteSort: true,
		fitColumns: true,
		singleSelect: true,
		pagination: true,
		pageList: pageList,
		pageSize: pageList[0],
		loadFilter: function(result) {
			if (result.code === 200) {
				return result.data;
			} else {
				return null;
			}
		},
		toolbar: [{
			iconCls: "icon-add",
			text: "添加",
			handler: function() {
				addHandler();
			}
		}, "-", {
			iconCls: "icon-edit",
			text: "修改",
			handler: function() {
				editHandler();
			}
		}, "-", {
			iconCls: "icon-delete",
			text: "删除",
			handler: function() {
				deleteHandler();
			}
		}, "-", {
			iconCls: "icon-pdf",
			text: "导出为pdf",
			handler: function() {
				$('#member_list').datagrid("print", "DataGrid");
			}
		}, "-", {
			iconCls: "icon-save",
			text: "保存为excell",
			handler: function() {
				$('#member_list').datagrid("toExcel", "帮派成员.xls");
			}
		}],
		columns: [[
			{field: "id", title: "角色ID", align:"center", width:100, sortable: true},
			{field: "roleId", title: "角色造型", align: "center", width: 80
				, formatter: function(value, rowData, rowIndex) {
					get("/role_modeling/selectById", {
						id: value
					}, function(result) {
						$("#role_" + rowIndex).attr("src", result.image)
							.attr("title", result.name);
					}, error);

					return "<img height='" + image_size + "' id='role_" + rowIndex + "' />";
				}
			},
			{field: "name", title: "帮派成员", align:"center", width: 100},
			{field: "grade", title: "等级", align:"center", width: 100, sortable: true},
			{field: "schoolId", title: "门派", align:"center", width: 100
				, formatter: function(value, rowData, rowIndex) {
					get("/school/selectById", {
						id: value
					}, function(result) {
						$("#school_" + rowData.id).attr("src", result.image)
							.attr("title", result.name);
					}, error);
					
					return "<img height='" + image_size + "' id='school_" + rowData.id + "' />";
				}
			},
			{field: "jobId", title: "职务", align:"center", width: 100, sortable: true
				, formatter: function(value, rowData, rowIndex) {
					get("/gang_job/selectById", {
						id: value
					}, function(res) {
						$("#job_" + rowData.id).html(res.name);
					}, error);
					
					return "<div id='job_" + rowData.id + "'></div>";
				}
			},
			{field: "thisWeek", title: "本周帮贡", align:"center", width: 100, sortable: true},
			{field: "current", title: "现有帮贡", align:"center", width: 100, sortable: true},
			{field: "history", title: "历史帮贡", align:"center", width: 100, sortable: true},
			{field: "lastUpdateTime", title: "最后一次修改", align:"center", width: 120}
		]]
	});

});

二、easyui控制表格字段显示

实现控制easyui表格datagrid的字段显示只需要一个方法。

let columnMenu;

/**
 * 创建表格的右键菜单
 * @param selector 表格dom对象的选择器
 */
function createColumnMenu(selector) {
	let datagrid = $(selector);
	let checked = "icon-checked";
	let unchecked = "icon-unchecked";

	columnMenu = $("<div/>").appendTo("body");

	columnMenu.menu({
		onClick: function(item){
			if (item.iconCls === checked){
				datagrid.datagrid("hideColumn", item.name);

				columnMenu.menu("setIcon", {
					target: item.target,
					iconCls: unchecked
				});
			} else {
				datagrid.datagrid("showColumn", item.name);

				columnMenu.menu("setIcon", {
					target: item.target,
					iconCls: checked
				});
			}
		}
	});

	let fields = datagrid.datagrid("getColumnFields");

	for(let i = 0; i< fields.length; i++){
		let field = fields[i];
		let column = datagrid.datagrid("getColumnOption", field);

		columnMenu.menu("appendItem", {
			text: column.title,
			name: field,
			iconCls: column.hidden ? unchecked : checked
		});
	}
}

然后在页面渲染表格的js代码中加入以下代码片段

onHeaderContextMenu: function(e) {
    e.preventDefault();

    if (!columnMenu){
        createColumnMenu(表格dom对象的选择器);
    }
    columnMenu.menu("show", {
        left: e.pageX,
        top: e.pageY
    });
},

比如,在上面给出的页面上添加这个功能之后

let requestUrl;
let height = 550;
let image_size = 40;

function addHandler() {
	let gangId = $("#gang_id").combobox("getValue");

	if (gangId) {
		$("#gangId").combobox("setValue", gangId);
	}

	requestUrl = "/gang_member/insert";

	$("#member_dialog").dialog("open");
}

function editHandler() {
	let rowData = $("#member_list").datagrid("getSelected");
	
	if (rowData) {
		requestUrl = "/gang_member/updateById";

		$("#id").textbox("setValue", rowData.id);
		$("#name").textbox("setValue", rowData.name);
		$("#jobId").combobox("setValue", rowData.jobId);
		$("#gangId").combobox("setValue", rowData.gangId);
		$("#roleId").combobox("setValue", rowData.roleId);
		$("#grade").numberspinner("setValue", rowData.grade);
		$("#schoolId").combobox("setValue", rowData.schoolId);
		$("#current").numberspinner("setValue", rowData.current);
		$("#history").numberspinner("setValue", rowData.history);
		$('#enterTime').datebox("setValue", rowData.enterTime);
		$('#lastOnline').datebox("setValue", rowData.lastOnline);
		$("#thisWeek").numberspinner("setValue", rowData.thisWeek);

		$("#member_dialog").dialog("open");
	} else {
		alertMsg("请选择要修改的记录!", "warning");
	}
}

function deleteHandler() {
	let rowData = $("#member_list").datagrid("getSelected");
	
	if (rowData) {
		$.messager.confirm('系统提示', '是否确认删除该帮派成员?', function(bool) {
			if (bool) {
				get("/gang_member/deleteById", {
					id: rowData.id
				}, function(response) {
					showMsg(response.message);

					$("#member_list").datagrid("reload");
				}, error);
			}
		});
	} else {
		alertMsg("请选择要删除的记录!", "warning");
	}
}

/**
 * 保存为pdf需要提供此方法
 */
function toPdf() {
	let body = $("#member_list").datagrid("toArray");

	let docDefinition = {
		content: [{
			table: {
				body: body,
				headerRows: 1,
				widths: ["*", "*", "*", "*", "auto", "*"]
			}
		}]
	};

	pdfMake.createPdf(docDefinition).open();
}

$(document).ready(function() {
	// 帮派
	$("#gang_id").combobox({
		url: "/gang/selectAll",
		valueField: "id",
		textField: "name",
		width: 150,
		panelHeight: "auto",
		prompt: "-选择帮派-"
	});

	// 角色名
	$("#_name_").textbox({
		width: 150,
		prompt: "输入角色名模糊查询"
	});

	$("#job_id").combobox({
		url: "/gang_job/selectAll",
		valueField: "id",
		textField: "name",
		width: 150,
		panelHeight: "auto",
		prompt: "输入帮派职务"
	});

	// 门派
	$("#school_id").combobox({
		url: "/school/selectAll",
		valueField: "id",
		textField: "name",
		width: 150,
		prompt: "-选择门派-",
		panelHeight: "auto",
		formatter: function(row) {
			return "<img width='20' src='" + row.image + "' />&nbsp;" + row.name;
		}
	});

	// 角色造型
	$("#role_id").combobox({
		url: "/role_modeling/selectAll",
		valueField: "id",
		textField: "name",
		width: 150,
		panelHeight: "auto",
		groupField: "phyle",
		prompt: "-请选择角色造型-",
		groupFormatter: function(group) {
			get("/phyle/selectById", {
				id: group
			}, function (res) {
				$("#_phyle_" + group).html(res.name);
			}, error);

			return "<span class='blue' id='_phyle_" + group + "'></span>";
		},
		formatter: function(row) {
			return "<img width='20' src='" + row.image + "' />&nbsp;" + row.name;
		}
	});

	// 搜索按钮
	$("#search").linkbutton({
		iconCls: "icon-search"
	}).click(function() {
		let name = $("#_name_").textbox("getValue");
		let jobId = $("#job_id").combobox("getValue");
		let roleId = $("#role_id").combobox("getValue");
		let gangId = $("#gang_id").combobox("getValue");
		let schoolId = $("#school_id").combobox("getValue");

		$("#member_list").datagrid('load', {
			name: name,
			jobId: jobId,
			roleId: roleId,
			gangId: gangId,
			schoolId: schoolId
		});
	});

	// 清空按钮
	$("#clear").linkbutton({
		iconCls: "icon-delete"
	}).click(function() {
		$("#form").form("clear");
	});



	$("#id").textbox({
		width: 100,
		required: true
	});
	
	$("#name").textbox({
		width: 100,
		required: true
	});
	
	$("#schoolId").combobox({
        url: "/school/selectAll",
		valueField: "id",
		textField: "name",
		width: 100,
		required: true,
		panelHeight: "auto",
		formatter: function(row) {
			return "<img width='20' src='" + row.image + "' />&nbsp;" + row.name;
		},
		onSelect: function(record){
	        if(record) {
	        	let url = "/role_modeling/selectByPhyle?phyle=" + record.phyle;

	        	$('#roleId').combobox("reload", url);
	        }
	    }
	});
	
	$("#roleId").combobox({
        url: "/role_modeling/selectAll",
        valueField: "id",
		textField: "name",
		width: 100,
		required: true,
		panelHeight: "auto",
		formatter: function(row) {
			get("/role_modeling/selectImageById", {
				id: row.id
			}, function(response) {
				$("#_modeling_" + row.id).attr("src", response.data);
			}, error);
			
			return "<img width='20' id='_modeling_" + row.id + "' />&nbsp;" + row.name;
		}
    });
	
	$("#grade").numberspinner({
        min: 0,
        width: 100,
        max: 115,
        editable: true,
        required: true
    });
	
	$("#jobId").combobox({
        url: "/gang_job/selectAll",
        valueField: "id",
		textField: "name",
		width: 100,
		required: true,
		panelHeight: "auto"
	});
	
    $("#thisWeek").numberspinner({
        min: 0,
        width: 100,
        required: true
    });
    
    $("#current").numberspinner({
        min: 0,
        width: 100,
        required: true
    });
    
    $("#history").numberspinner({
        min: 0,
        width: 100,
        required: true
    });

	$("#gangId").combobox({
		url: "/gang/selectAll",
		valueField: "id",
		textField: "name",
		width: 100,
		required: true,
		panelHeight: "auto"
	});
    
    $("#enterTime").datebox({
    	width: 185,
        required: true
    });
    
    $("#lastOnline").datebox({
    	width: 185,
        required: true
    });
    
	$("#member_dialog").dialog({
		title: "成员信息",
		modal: true,
		closed: true,
		closable: true,
		draggable: false,
		buttons: [{
			iconCls: "icon-save",
			text: "保存",
			handler: function() {
				let selector = "#member_form";

				checkForm(selector, function () {
					let data = $(selector).serialize();

					post(requestUrl, data, function(response) {
						showMsg(response.message);

						$(selector).form("clear");
						$("#member_dialog").dialog("close");
						$("#member_list").datagrid("close");
					}, error);
				});
			}
		}, {
			iconCls: "icon-cancel",
			text: "取消",
			handler: function() {
				$("#member_dialog").dialog("close");
				$("#member_form").form("clear");
			}
		}]
	});
	
	$("#member_list").datagrid({
		url: "/gang_member/selectByPage",
		striped: true,
		height: height,
		multiSort: true,
		remoteSort: true,
		fitColumns: true,
		singleSelect: true,
		pagination: true,
		pageList: pageList,
		pageSize: pageList[0],
		loadFilter: function(result) {
			if (result.code === 200) {
				return result.data;
			} else {
				return null;
			}
		},
		onHeaderContextMenu: function(e) {
			e.preventDefault();

			if (!columnMenu){
				createColumnMenu("#member_list");
			}
			columnMenu.menu("show", {
				left: e.pageX,
				top: e.pageY
			});
		},
		toolbar: [{
			iconCls: "icon-add",
			text: "添加",
			handler: function() {
				addHandler();
			}
		}, "-", {
			iconCls: "icon-edit",
			text: "修改",
			handler: function() {
				editHandler();
			}
		}, "-", {
			iconCls: "icon-delete",
			text: "删除",
			handler: function() {
				deleteHandler();
			}
		}, "-", {
			iconCls: "icon-pdf",
			text: "导出为pdf",
			handler: function() {
				$('#member_list').datagrid("print", "DataGrid");
			}
		}, "-", {
			iconCls: "icon-save",
			text: "保存为excell",
			handler: function() {
				$('#member_list').datagrid("toExcel", "帮派成员.xls");
			}
		}],
		columns: [[
			{field: "id", title: "角色ID", align:"center", width:100, sortable: true},
			{field: "roleId", title: "角色造型", align: "center", width: 80
				, formatter: function(value, rowData, rowIndex) {
					get("/role_modeling/selectById", {
						id: value
					}, function(result) {
						$("#role_" + rowIndex).attr("src", result.image)
							.attr("title", result.name);
					}, error);

					return "<img height='" + image_size + "' id='role_" + rowIndex + "' />";
				}
			},
			{field: "name", title: "帮派成员", align:"center", width: 100},
			{field: "grade", title: "等级", align:"center", width: 100, sortable: true},
			{field: "schoolId", title: "门派", align:"center", width: 100
				, formatter: function(value, rowData, rowIndex) {
					get("/school/selectById", {
						id: value
					}, function(result) {
						$("#school_" + rowData.id).attr("src", result.image)
							.attr("title", result.name);
					}, error);
					
					return "<img height='" + image_size + "' id='school_" + rowData.id + "' />";
				}
			},
			{field: "jobId", title: "职务", align:"center", width: 100, sortable: true
				, formatter: function(value, rowData, rowIndex) {
					get("/gang_job/selectById", {
						id: value
					}, function(res) {
						$("#job_" + rowData.id).html(res.name);
					}, error);
					
					return "<div id='job_" + rowData.id + "'></div>";
				}
			},
			{field: "thisWeek", title: "本周帮贡", align:"center", width: 100, sortable: true},
			{field: "current", title: "现有帮贡", align:"center", width: 100, sortable: true},
			{field: "history", title: "历史帮贡", align:"center", width: 100, sortable: true},
			{field: "lastUpdateTime", title: "最后一次修改", align:"center", width: 120}
		]]
	});

});

右键单击表格的标题,通过点击菜单对应的表格中的字段名可以控制字段显示/隐藏。

文章中使用的导出js文件可以通过以下网盘连接获取:

easyui常用的js文件https://pan.baidu.com/s/1lez6R9DbdCeoDv_-45KNPQ?pwd=dxe1

或者通过以下gitee项目

mhxysyicon-default.png?t=N6B9https://gitee.com/he-yunlin/mhxysy.git

好了,文章就分享到这里了,看完不要忘了点赞+收藏哦~

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/839885.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

matlab计算基础

目录 1. 创建矩阵和向量 2. 矩阵的基本运算 2.1 数乘 2.2 转秩 2.3 求逆 2.4 点积 2.5 拼接 3. 复数 4. 矩阵元素的引用 5.工作区中数据的保存和使用 1. 创建矩阵和向量 向量包括行向量和列向量&#xff0c;向量就是个特殊的矩阵&#xff0c;向量可看作C语言中的一维…

华为OD机试之报文回路(Java源码)

题目描述 IGMP 协议中响应报文和查询报文&#xff0c;是维系组播通路的两个重要报文&#xff0c;在一条已经建立的组播通路中两个相邻的 HOST 和 ROUTER&#xff0c;ROUTER 会给 HOST 发送查询报文&#xff0c;HOST 收到查询报文后给 ROUTER 回复一个响应报文&#xff0c;以维持…

网络:从socket编程的角度说明UDP和TCP的关系,http和tcp的区别

尝试从编程的角度解释各种网络协议。 UDP和TCP的关系 从Python的socket编程角度出发&#xff0c;UDP&#xff08;User Datagram Protocol&#xff09;和TCP&#xff08;Transmission Control Protocol&#xff09;是两种不同的传输协议。 TCP是一种面向连接的协议&#xff0c…

2022深圳杯C题思路解析

题目描述&#xff1a; 继续更新 再更问题三 继续更新第一问、第四问 1.2 问题重述 在制定电动车调度方案时&#xff0c;必须考虑充、换电池的时间成本&#xff0c;从而提出了新 的车辆运输选址及调度问题。 1&#xff09; 已知自动驾驶电动物料车在取料点 P 和卸货点 D …

STM32CubeMX+VSCODE+EIDE+RT-THREAD 工程创建

Eide环境搭建暂且不表&#xff0c;后续补充。主要记录下Vscode环境下 创建Rt-thread工程的过程。分别介绍STM32CubeMX添加rtt支持包的方式和手动添加rtt kernel方式。STM32CubeMX生成工程的时候有"坑"&#xff0c;防止下次忘记&#xff0c;方便渡一下有缘人&#xff…

MYSQL进阶-事务的基础知识

1.什么是数据库事务&#xff1f; 就是把好几个sql语句打包成一个整体执行&#xff0c;要么全部成功&#xff0c;要么全部失败&#xff01;&#xff01;&#xff01; 事务是一个不可分割的数据库操作序列&#xff0c;也是数据库并发控制的基本单位&#xff0c;其执 行的结果必…

【RabbitMQ】golang客户端教程3——发布订阅(使用fanout交换器)

发布订阅 在上一个教程中&#xff0c;我们创建了一个工作队列。工作队列背后的假设是每个任务只传递给一个工人。在这一部分中&#xff0c;我们将做一些完全不同的事情——我们将向多个消费者传递一个消息。这就是所谓的“订阅/发布模式”。 为了说明这种模式&#xff0c;我们…

Vulnhub: DriftingBlues: 6靶机

kali&#xff1a;192.168.111.111 靶机&#xff1a;192.168.111.180 信息收集 端口扫描 nmap -A -sC -v -sV -T5 -p- --scripthttp-enum 192.168.111.180 查看robots.txt发现存在目录&#xff1a;/textpattern/textpattern 访问后发现是textpattern cms 目录爆破发现文件sp…

尚品汇总结三:商城首页(面试专用)

目录 首页商品分类实现 1、封装数据接口 2、页面静态化&#xff1a; 什么是页面静态化 为什么要使用静态化 首页商品分类实现 前面做了商品详情&#xff0c;我们现在来做首页分类&#xff0c;我先看看京东的首页分类效果&#xff0c;我们如何实现类似效果&#xff1a; 思路…

2020年06月《全国青少年软件编程等级考试》Python一级真题解析

一、单选题 第1题 以下哪种输入结果不可能得到以下反馈&#xff1a; 重要的事情说三遍&#xff1a;安全第一&#xff01;安全第一&#xff01;安全第一&#xff01; A&#xff1a;print(“重要事情说三遍&#xff1a;”“安全第一&#xff01;”*3) B&#xff1a;print(“重…

扩散模型实战(一):基本原理介绍

扩散模型&#xff08;Diffusion Model&#xff09;是⼀类⼗分先进的基于物理热⼒学中的扩散思想的深度学习⽣成模型&#xff0c;主要包括前向扩散和反向扩散两个过程。⽣成模型除了扩散模型之外&#xff0c;还有出现较早的VAE&#xff08;Variational Auto-Encoder&#xff0c;…

【TypeScript】初识TypeScript和变量类型介绍

TypeScript 1&#xff0c;TypeScript是什么?2&#xff0c;类型的缺失带来的影响3&#xff0c;Ts搭建环境-本博主有专门的文章专说明这个4&#xff0c;使用tsc对ts文件进行编译5&#xff0c;TS运行初体验简化Ts运行步骤解决方案1解决方案2&#xff08;常见&#xff09; 开始学习…

【探索Linux】—— 步步学习强大的命令行工具 P.1(Linux简介)

目录 前言 一、Linux简介 二、linux的不同发行版本 三、Linux的开源性质 四、Linux的特点 五、Linux代码演示&#xff08;仅供参考&#xff09; 总结 前言 前面我们讲了C语言的基础知识&#xff0c;也了解了一些数据结构&#xff0c;并且讲了有关C的一些知识&#xff…

如何将本地的conda算法库打包到无网络的服务器用于部署

如何将本地的conda算法库打包到无网络的服务器用于部署 1、先安装conda-pack库&#xff0c;2、将本地的虚拟环境进行打包3、登录远程服务器&#xff0c;切换到conda安装目录&#xff0c;将本地生成的tar文件复制到该目录下4、新建文件夹&#xff0c;例如yus_env&#xff0c;这个…

并查集练习 —岛屿数量(解法一)

题目&#xff1a; 给定一个二维数组matrix&#xff08;char[][]&#xff09;&#xff0c;里面的值不是1就是0&#xff0c;上、下、左、右相邻的1认为是一片岛。返回matrix中岛的数量。 本题共有2种解法&#xff0c;本篇先介绍最快的一种解法—递归。 分析&#xff1a; 递归的方…

65 # 实现 http-server 里的 gzip 压缩

用 zlib 来实现 gzip 压缩 服务端优化都是&#xff1a;压缩 缓存 前端可以通过 webpack 插件进行压缩 gzip 根据替换来实现的&#xff0c;重复率越高&#xff0c;压缩后的结果越小 const zlib require("zlib"); const fs require("fs"); const path …

K8S kubeadm搭建

kubeadm搭建整体步骤 1&#xff09;所有节点进行初始化&#xff0c;安装docker引擎和kubeadm kubelet kubectl 2&#xff09;生成集群初始化配置文件并进行修改 3&#xff09;使用kubeadm init根据初始化配置文件生成K8S的master控制管理节点 4&#xff09;安装CNI网络插件&am…

分页Demo

目录 一、分页对象封装 分页数据对象 分页查询实体类 实体类用到的utils ServiceException StringUtils SqlUtil BaseMapperPlus,> BeanCopyUtils 二、示例 controller service dao 一、分页对象封装 分页数据对象 import cn.hutool.http.HttpStatus; import com.…

EditPlus连接Linux系统远程操作文件

EditPlus是一套功能强大的文本编辑器&#xff01; 1.File ->FTP->FTP Settings&#xff1b; 2.Add->Description->FTP server->Username->Password->Subdirectory->Advanced Options 注意&#xff1a;这里的Subdirectory设置的是以后上传文件的默认…

C. Mark and His Unfinished Essay - 思维

分析&#xff1a; 直接模拟操作会mle&#xff0c;可以每次复制记录对应源字符串的下标&#xff0c;可以记录每次字符串增加的长度的左右端点下标&#xff0c;可以发现左端点与读入的l是对应的&#xff0c;因此就可以向前移到l的位置&#xff0c;这样层层递归&#xff0c;就能找…