easyui增删改查前段代码
生活随笔
收集整理的這篇文章主要介紹了
easyui增删改查前段代码
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
easyui增刪改查前段代碼
?
?
?
<script>var url;//添加用戶窗體 function newUser(){$('#dlg').dialog('open').dialog('setTitle', '學生信息添加');$('#fm').form('clear');url = '/Students/Add';}//編輯 function editUser(){var row = $('#dg').datagrid('getSelected');if (row) {$('#dlg').dialog('open').dialog('setTitle', '修改學生信息');$('#fm').form('load', row);url = '/Students/Edit/' + row.StuId;}}//提交方法 function saveUser() {$('#fm').form('submit', {url: url,onSubmit: function () {return $(this).form('validate');},success: function (data) {if (data.Result==false) {$.messager.show({title: 'Error',msg: data.Message});} else {$('#dlg').dialog('close'); // close the dialog$('#dg').datagrid('reload'); // reload the user data }}});}function InitGrid(){$("#dg").datagrid({url: '/Students/StudentRead',title: '學生列表',toolbar: '#toolbar',rownumbers: true,fitcolumns: true,singleselect: true});}</script><table id="dg" title="My Users" class="easyui-datagrid" style="width:550px;height:250px"url="/Students/StudentRead"toolbar="#toolbar"rownumbers="true" fitcolumns="true" singleselect="true"><thead><tr><th field="StuName" width="50">學生姓名</th><th field="Age" width="50">年齡</th><th field="Sex" width="50">性別</th><th field="CreateTime" width="50">創(chuàng)建時間</th></tr></thead> </table><div id="toolbar"><a href="#" class="easyui-linkbutton" iconcls="icon-add" plain="true" οnclick="newUser()">New User</a><a href="#" class="easyui-linkbutton" iconcls="icon-edit" plain="true" οnclick="editUser()">Edit User</a><a href="#" class="easyui-linkbutton" iconcls="icon-remove" plain="true" οnclick="destroyUser()">Remove User</a> </div><div id="dlg" class="easyui-dialog" style="width:400px;height:280px;padding:10px 20px"closed="true" buttons="#dlg-buttons"><div class="ftitle">學生信息</div><form id="fm" method="post"><div class="fitem"><label>StuName:</label><input name="StuName" class="easyui-textbox"></div><div class="fitem"><label>Age:</label><input name="Age" class="easyui-textbox"></div><input type="hidden" name="StuId"/></form> </div> <div id="dlg-buttons"><a href="#" class="easyui-linkbutton" iconcls="icon-ok" οnclick="saveUser()">Save</a><a href="#" class="easyui-linkbutton" iconcls="icon-cancel" οnclick="javascript:$('#dlg').dialog('close')">Cancel</a> </div>?
posted on 2019-04-06 21:40 天然灰 閱讀(...) 評論(...) 編輯 收藏轉載于:https://www.cnblogs.com/tianranhui/p/10663010.html
總結
以上是生活随笔為你收集整理的easyui增删改查前段代码的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Python由于目标计算机积极拒绝,无法
- 下一篇: VMware虚拟机在仅主机模式下的网卡无