easyui editable data grid simple try

jquery.edatagrid.js download: http://www.jeasyui.net/extension/190.html In the example here, paste the code
directly , and it is actually quite easy to see the website above
<%--
  Created by IntelliJ IDEA.
  User: hasee
  Date: 2017/2/11
  Time: 12:58
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title></title>
    <link rel="stylesheet" type="text/css" href="/ssm/static/jquery-easyui-1.5.1/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="/ssm/static/jquery-easyui-1.5.1/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="/ssm/static/jquery-easyui-1.5.1/demo/demo.css">
    <script type="text/javascript" src="/ssm/static/jquery-easyui-1.5.1/jquery.min.js"></script>
    <script type="text/javascript" src="/ssm/static/jquery-easyui-1.5.1/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/ssm/static/jquery-easyui-1.5.1/jquery.edatagrid.js"></script>


</head>
<body>
<table id="dg" title="My Users" style="width:700px;height:250px"
       toolbar="#toolbar"  idField="id_"
       rownumbers="true" fitColumns="true" singleSelect="true">
    <thead>
    <tr>
        <th field="id_" width="50" editor="{type:'validatebox',options:{required:true}}">id_</th>
        <th field="name_" width="50" editor="{type:'validatebox',options:{required:true}}">姓名</th>
        <th field="age_" width="50" editor="text">年龄_</th>
    </tr>
    </thead>
</table>
<div id="toolbar">
    <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="javascript:$('#dg').edatagrid('addRow')">New</a>
    <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="javascript:$('#dg').edatagrid('destroyRow')">Destroy</a>
    <a href="#" class="easyui-linkbutton" iconCls="icon-save" plain="true" onclick="javascript:$('#dg').edatagrid('saveRow')">Save</a>
    <a href="#" class="easyui-linkbutton" iconCls="icon-undo" plain="true" onclick="javascript:$('#dg').edatagrid('cancelRow')">Cancel</a>
</div>
<script type="text/javascript">
    $(function () {
        $('#dg').edatagrid({
            url: 'e_query.do',
            saveUrl: 'e_insert.do',
            updateUrl: 'e_update.do',
            destroyUrl: 'e_delete.do' //When deleting a row, the id will be passed, not id_
        });
    });
</script>
</body>
</html>

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326989484&siteId=291194637