SSH结合EasyUI的分页操作(数据的增删改查)
一.效果展示图
如下:
注:1.可以根据条件进行检索,结果直接显示在列表当中。
2.可以双击当前行,进入编辑模式,点击保存则修改确认,点击撤销则取消编辑。
3.点击添加,会在第一行新增编辑行,点击保存,会在列表的结尾新增一条记录。
二.前端代码分析
- Body部分代码
<body>
<form name="searchform" method="post" action="" id="searchform">
<td width="70" height="30">条件检索:</td>
<td height="30"><input type="text" name="condition" size=20
id="search_value"> <select name="value" id="search_type">
<option value="-1">请选择搜索类型</option>
<option value="name">按姓名搜索</option>
<option value="address">按地址搜索</option>
</select> <a id="submit_search">搜索</a></td>
</form>
<table id="mydatagrid">
<thead>
<tr>
<!-- 下面的editor表示可编辑框的相关属性-->
<th
data-options="field:'name',width:100,align:'center',editor: { type: 'text', options: { required: true } }">姓名</th>
<th
data-options="field:'age',width:100,align:'center',sortable:true,editor: { type: 'text', options: { required: true } }"
onclick="sort()">年龄</th>
<th
data-options="field:'address',width:100,align:'center',editor: { type: 'text', options: { required: true } }">地址</th>
<th
data-options="field:'account',width:100,align:'center',editor: { type: 'text', options: { required: true } }">账户</th>
<th
data-options="field:'password',width:100,align:'center',editor: { type: 'text', options: { required: true } }">密码</th>
<th
data-options="field:'email',width:100,align:'center',editor: { type: 'text', options: { required: true } }">邮箱</th>
<th
data-options="field:'company',width:100,align:'center',editor: { type: 'text', options: { required: true } }">单位</th>
</tr>
</thead>
</table>
</body>
- JS部分代码