然然爱问

导航

jquery easyui 增删改查询

jsp页面:

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <script type="text/javascript" src="js/jquery/jquery-1.8.0.min.js"></script> <script type="text/javascript" src="js/jquery/jquery.easyui.min.js"></script> <link id="easyuiTheme" rel="stylesheet" href="css/easyui/themes/<c:out value="${cookie.easyuiThemeName.value}" default="default"/>/easyui.css" type="text/css"></link> <link rel="stylesheet" href="css/easyui/themes/icon.css" type="text/css"></link> <script type="text/javascript" src="js/jquery/easyui-lang-zh_CN.js"></script> <script type="text/javascript" src="js/datagrid.js"></script> <script type="text/javascript"> $(function(){ $('#listTable').datagrid({ url:'system/systemRole_queryRole.action', loadMsg:'数据加载中........', toolbar: [{ text:'增加', iconCls: 'icon-add', handler: function(){addRole()} },'-',{ text:'删除', iconCls: 'icon-remove', handler: function(){} },'-',{ text:'修改', iconCls: 'icon-edit', handler: function(){} },'-',{ text:'维护', iconCls: 'icon-cut', handler: function(){} },'-',{ text:'分配', iconCls: 'icon-edit', handler: function(){} }], idField:'uuid',//不同页面保持选择状态 striped:true, border:true, fit:true, rownumbers:true, pagination:true, fitColumns:true, pageSize:20, pageList:[20,30,40,50], columns:[[ {field:'uuid',checkbox:true}, {field:'mc',title:'角色名称',width:50,align:'center'} ]] }) }) /** *增加角色 */ function addRole(){ $('#dialog').dialog({ title: '增加角色', width: 280, height: 139, cache: false, modal: true, closable:false,//不显示关闭按钮 buttons: [ { text:'提交', iconCls:'icon-ok', handler:function(){ var mc=$('#mc').val(); if(mc!=null && mc.length>=0){ $('#addROLEFORM').form('submit',{ url:'system/systemRole_saveRole.action', onSubmit: function(){ return $(this).form('validate'); }, success:function(data){ var result=$.parseJSON(data); if(result.status==0){ $.messager.alert('错误',result.msg,"error"); }else{ $('#listTable').datagrid('load'); $('#dialog').dialog('close'); } } }) } }},{ text:'取消',handler:function(){ $('#dialog').dialog('close'); }} ] }) } </script> </head> <body> <!-- 查询 --> <table id="listTable"></table> <!-- 弹出对话框增加form --> <div id="dialog"> <form id="addROLEFORM" method="post"> <table align="center"> <tr align="right"> <tr> <td>角色名称:<font color='red'>*</font></td> <td><input class="easyui-validatebox" id="mc" name="mc" data-options="required:true,validType:'chinese',missingMessage:'该输入项不能为空且为中文',tipPosition:'right'" ></input></td> </tr> <tr align="right"> <tr> <td>角色标志:</td> <td><input class="easyui-validatebox" name="bz" data-options="validType:'chinese',missingMessage:'该输入项不能为空且为中文',tipPosition:'right'" ></input></td> </tr> </table> </form> </div> </body> </html>



 

posted on 2013-04-08 22:06  然然爱问  阅读(4050)  评论(0编辑  收藏  举报