easyui里弹窗的两种表现形式
1、主JSP页面中描绘弹窗
- <div id="centerDiv" data-options="region:'center',border:false">
- <table id="networkQueryGrid"
- data-options="queryForm:'#queryForm',title:'查询结果',iconCls:'pag-list'"></table>
- </div>
- <div id="restartDialog" class="easyui-dialog" title="重新启动网络" style="width: 400px; height: 180px;"
- data-options="iconCls:'pag-list',modal:true,collapsible:false,minimizable:false,maximizable:false,resizable:false,closed:true">
- <div style="margin-left: 5px;margin-right: 5px;margin-top: 5px;">
- <div class="data-tips-info">
- <div class="data-tips-tip icon-tip"></div>
- 此网络提供的所有服务都将中断。请确认您确实要重新启动此网络。
- </div>
- <table style="margin-top: 20px;margin-left:20px;margin-right:20px;vertical-align:middle;" width="80%" border="0" cellpadding="0" cellspacing="1">
- <tr>
- <td style="width:20%;text-align:right;">
- 清理:
- </td>
- <td style="text-align:left;">
- <input type="hidden" id="networkId" name="networkId"/>
- <input type="checkbox" id="cleanUp" name="cleanUp"/>
- </td>
- </tr>
- </table>
- <div style="text-align:right;margin-right:30px;">
- <a href="#" class="easyui-linkbutton" data-options="iconCls:'ope-finish'" onclick="restartNetwork()">确定</a>
- <a href="#" class="easyui-linkbutton" data-options="iconCls:'ope-cancel'" onclick="cancel()">取消</a>
- </div>
- </div>
- </div>
JS:
- function showRestartDialog(id){
- $("#networkId").val(id);
- $("#restartDialog").dialog('open');
- }
- function restartNetwork(){
- cancel();
- var checked = $("#cleanUp").prop("checked");
- invokeAjax('/network/restartNetwork','networkId=' + $("#networkId").val() + '&cleanUp='+checked,'重新启动');
- }
- function cancel(){
- $('#restartDialog').window('close');
- }
2、直接在JS里绘制弹窗(弹窗为单独页面文件)
Toobar可放置到主JSP页面:
- <div id="toolbar" style="text-align:right;">
- <a href="#" class="easyui-linkbutton" data-options="iconCls:'ope-finish'" onclick="associateIP()">获取新IP</a>
- </div>
JS:
- function showPublicIpDialog(row){
- var networkId ;
- var zoneId = row.zoneId;
- var virtualMachineId = row.id;
- if(row.nics && row.nics.length > 0){
- networkId = row.nics[0].networkId;
- }
- var ipHref = _root +'/vm/viewAllocateIP?networkId='+networkId+'&zoneId='+zoneId;
- $dialog = $('<div/>').dialog({
- title: '分配公网IP',
- width: 400,
- height: 250,
- iconCls : 'pag-search',
- closed: true,
- cache: false,
- href: ipHref,
- modal: true,
- toolbar:'#toolbar',
- onLoad:function(){
- //设置其他数据
- $("#zoneId").val(row.zoneId);
- if(row.nics && row.nics.length > 0){
- $("#networkId").val(row.nics[0].networkId);
- }
- },
- buttons : [ {
- text : '确定',
- iconCls : 'ope-save',
- handler : function() {
- var $radio = $("input[type='radio']:checked");
- var iPAddressId = $radio.val();
- if($radio.length == 0 || iPAddressId == ""){
- $.messager.alert('提示', '请选择IP','info'); return;
- }
- $.ajax({
- url: _root + "/vm/enableStaticNat",
- type: "post",
- data: {virtualMachineId:virtualMachineId,iPAddressId:iPAddressId},
- dataType: "json",
- success: function (response, textStatus, XMLHttpRequest) {
- if(response!=null && response.success){
- $.messager.alert('提示','分配公网IP成功','info',function(){
- $dialog.dialog('close');
- $obj.SuperDataGrid('reload');
- });
- }else if(response!=null&&!response.success){
- $.messager.alert('提示','分配公网IP失败','error');
- }
- }
- })
- }
- }, {
- text : '取消',
- iconCls : 'ope-close',
- handler : function() {
- $dialog.dialog('close');
- }
- } ]
- });
- $dialog.dialog('open');
- }
- function associateIP(){
- ...
- }
Controller:
- /**
- * 跳转到弹窗页面
- */
- @RequestMapping(value = "/viewAllocateIP", method = {RequestMethod.GET,RequestMethod.POST})
- public ModelAndView viewAllocateIP(@RequestParam String networkId,@RequestParam String zoneId) {
- ModelAndView model = new ModelAndView();
- model.setViewName("vm/allocateIP");
- try {
- Set<PublicIPAddress> ips = virtualMachineService.listPublicIpAddresses(networkId,zoneId);
- model.addObject("ips", ips);
- } catch(BusinessException e) {
- throw new ControllerException(HttpStatus.OK, e.getCode(), e.getMessage());
- } catch(Exception e) {
- final String msg = messageSource.getMessage(TipsConstants.QUERY_FAILURE);
- throw throwControllerException(LOGGER, HttpStatus.OK, null, msg, msg, e);
- }
- return model;
- }
allocateIP.jsp:
- <body>
- <input type="hidden" name="zoneId" id="zoneId" />
- <input type="hidden" name="networkId" id="networkId" />
- <div class="easyui-layout" data-options="fit:true" style="padding: 0px;">
- <div data-options="region:'center',border:false">
- <c:if test="${!empty ips}">
- <table class="ipTable" width="95%" border="1" borderColor="#DEDEDE" cellpadding="0" cellspacing="0">
- <c:forEach items="${ips }" var="item">
- <tr>
- <td style="width: 35px; text-align: center;"><input type="radio" value="${item.id }" name="ids" /></td>
- <td style="padding-left: 35px; font-size: 13px;">${item.IPAddress }</td>
- </tr>
- </c:forEach>
- </table>
- </c:if>
- </div>
- </div>
- </body>
easyui里弹窗的两种表现形式的更多相关文章
- [转载]EasyUI Pagination 分页的两种做法
EasyUI 的 datagrid 支持服务器端分页,但是官方的资料比较少,以下总结了两种 datagrid 的服务器端分页机制,可根据情况具体使用. 一:使用 datagrid 默认机制 后台: p ...
- EasyUI Pagination 分页的两种做法
EasyUI 的 datagrid 支持服务器端分页,但是官方的资料比较少,以下总结了两种 datagrid 的服务器端分页机制,可根据情况具体使用. 一:使用 datagrid 默认机制 后台: p ...
- Easyui 创建dialog的两种方式,以及他们带来的问题
$('#yy').dialog('open');//打开dialog 这地方要注意,加入你关闭窗口的地方使用$('#yy').dialog('destroy');那么你这个dialog就只能使用一次, ...
- EasyUI 之 DataGrid的两种赋值方法
方法一:使用ViewData赋值 首先,我们创建一个User的实体类 public class User { public string UserID; public string UserName; ...
- Flask 中蓝图的两种表现形式
最近在学Flask,特有的@X.route 很适合RESTfuld API, 一般小型应用,在一个py文件中就可以完成,但是维护起来比较麻烦. 想体验Django那样的MVT模式, 看到 Flask提 ...
- 1. easyui tree 初始化的两种方式
/** * 查询角色分类 */function queryRoleCategoryTree(selectId) { var url = basePath + 'rest/roleCategoryCon ...
- dataTable 从服务器获取数据源的两种表现形式
var table = $('#example1').DataTable({ "processing": true,//加载效果 "autoWidth": fa ...
- 图文详解两种算法:深度优先遍历(DFS)和广度优先遍历(BFS)
参考网址:图文详解两种算法:深度优先遍历(DFS)和广度优先遍历(BFS) - 51CTO.COM 深度优先遍历(Depth First Search, 简称 DFS) 与广度优先遍历(Breath ...
- Redis中持久化的两种方法详解
Redis提供了两种不同的持久化方法来将数据存储到硬盘里面.一种方法叫快照(snapshotting),它可以将存在于某一时刻的所有数据都写入硬盘里;另一种方法教只追加文件(append-only f ...
随机推荐
- eclipse中运行项目时报Class not found的错误
环境:Groovy/Grails Tool Suite 3.1.0.RELEASE(BASED ON ECLIPSE JUNO 3.8.1).JDK1.6 运行class的main方法,或启动juni ...
- andriod学习之一
今天安装了Android Studio, 但PinyinIME没有导入成功.然后看了Android的一些基础. 知道了Android的基本组件: Activity,服务,内容提供程序,广播接收器. 大 ...
- Bean
1. Bean配置项 1.1. ID 在整个IOC容器中Bean的唯一标识 1.2. Class 具体要实例化的类 1.3. Scope 范围,作用域 1.4. Constructor argumen ...
- js 添加广告
需要调用广告的页面 <script type="text/javascript"> var xzname="巨蟹座";</script& ...
- selenium加载时间过长
为了获取网站js渲染后的html,需要利用selenium加载网站,但是会出现加载时间过长的现象,因此可以限制其加载时间以及强制关掉加载: # !/usr/bin/python3.4 # -*- co ...
- Google 的开源技术protobuf 简介与例子
本文来自CSDN博客:http://blog.csdn.NET/program_think/archive/2009/05/31/4229773.aspx 今天来介绍一下"Protocol ...
- 【freemaker】之自定义指令<#macro>
测试代码 @Test public void test07(){ try { root.put("name", "张三"); freemakerUtil.fpr ...
- TMS320C54x系列DSP指令和编程指南——第1章 汇编语言工具概述
第1章 汇编语言工具概述 TMS320C54x DSP的汇编语言开发工具包括: ■ Assembler ■ Archiver ■ Linker ■ Absolut ...
- TNS-12547 Linux Error: 104: Connection reset by pe (转载)
TNS-12547 Linux Error: 104: Connection reset by peer 解决过程参考:http://blog.chinaunix.net/u/7121/showart ...
- WinCE系统深度定制汇总
WinCE应用程序崩溃提示框的处理 WinCE6.0多国语言软键盘 定制WinCE6.0标准界面的一种方法 如何禁用WinCE下的沙漏图标 Silent RNAApp.exe for WinCE6.0 ...