EasyUi–7.tab和datagrid和iframe的问题
1. 多个tab切换,第2个不显示
动态添加tab Iframe页面的方法
展开
折叠 <script type="text/javascript">
$(function () {
//创建树形结构
var tt = $('#main-center');
$('#tt').tree({
url: '/Backstage/Home/MenuItem/',
//单击事件
onClick: function (node) {
//console.info($('#main-center').tabs('exists', node.text))
//console.info(node.attributes.url)
if (node.children == null) {
//tab已经打开1个了
if (tt.tabs('exists', node.text)) {
tt.tabs('select', node.text);
}
else {
console.info(node.attributes.url)
$('#main-center').tabs('add', {
title: node.text,
//href: node.attributes.url,
closable: true,
content : '<iframe scrolling="yes" frameborder="0" src="' + node.attributes.url + '" style="width:100%;height:100%;"></iframe>'
});
} }
}
});
}) //function addTab(title, href) {
// var tt = $('#main-center');
// if (tt.tabs('exists', title)) {
// tt.tabs('select', title);
// } else {
// if (href) {
// var content = '<iframe scrolling="yes" frameborder="0" src="' + href + '" style="width:100%;height:100%;"></iframe>';
// } else {
// var content = '未实现';
// }
// tt.tabs('add', {
// title: title,
// closable: true,
// content: content
// });
// }
//}
</script>
2.datagrid里的控件 创建tab
2.1 父页的jquery和iframe里面的jquery获取到的元素调用不是easyui的扩展后的对象,没有tabs方法,要调用父页的jquery
parent.$('#main-center', parent.document).tabs('add', {
title: '修改',
href: '/Backstage/MenuItem/getMenuItemContent?id=' + rows[0].ID,
closable: true,
//content: '<iframe scrolling="yes" frameborder="0" src="' + '/Backstage/MenuItem/getMenuItemContent?id=' + rows[0].ID + '" style="width:100%;height:100%;"></iframe>'
});
完整代码
//-----------修改按钮-------------
function editFun() {
var rows = _datagrid.datagrid('getSelections');
//alert(rows[0]);
//console.info(rows[0].ID)
//选择多行
if (rows.length != 1 && rows.length != 0) {
var names = [];
for (var i = 0; i < rows.length; i++) {
names.push(rows[i].UserName);
}
$.messager.show({
title: '提示',
msg: '只能选择一条记录编辑!<br>您选择了' + names.length + '条记录!'
});
} else if (rows.length == 0) {
$.messager.alert('提示', '请选择要修改的记录!', 'error')
}
//选择1行
else if (rows.length == 1) { //-----修改按钮-----start
//console.info($('#main-center'))
//console.info($(window.parent.document.body).find('#main-center'))
parent.$('#main-center', parent.document).tabs('add', {
title: '修改',
href: '/Backstage/MenuItem/getMenuItemContent?id=' + rows[0].ID,
closable: true,
//content: '<iframe scrolling="yes" frameborder="0" src="' + '/Backstage/MenuItem/getMenuItemContent?id=' + rows[0].ID + '" style="width:100%;height:100%;"></iframe>'
});
//-----修改按钮-----start
}
}
EasyUi–7.tab和datagrid和iframe的问题的更多相关文章
- EasyUi–7.tab和datagrid和iframe的问题
1. 多个tab切换,第2个不显示 动态添加tab Iframe页面的方法 展开 折叠 <script type="text/javascript"> $(functi ...
- easyUI跨Tab操作datagrid
1.在datagrid那个页面定义方法 window.top["RELOAD_MY_DATAGRID"]=function(){ $("#dg").datagr ...
- easyui中Tab的tools按钮刷新当前tab
easyui中Tab的tools按钮刷新当前tab 点击刷新按钮,刷新当前Tab选项卡. $('#index_tabs').tabs({ fit : true, border : false, too ...
- 【easyui】Tab的tools按钮刷新当前tab
点击刷新按钮,刷新当前Tab选项卡 /** * Name 选项卡初始化 */ $('#home-tabs').tabs({ tools: [{ iconCls: 'icon-reload', bord ...
- 由easyui的tab在ie下渲染失败,发现的一个有意义的问题
今天项目组的同事反映,在IE浏览器下,所有用easyui编写的tab控件都加载不出来,只会显示一个Loading的提示在控件的内容显示区. 刚分析这个问题,首先怀疑是使用easyui的tab的脚本写法 ...
- easyui的tab加载页面中的form重复提交
http://blog.csdn.net/fxz1982/article/details/8987769 Easyui中的tabs组件以href方式加载目标页面,如果目标页面中有dialog或者win ...
- 关于easyui的tab,layout,datagrid嵌套的问题
我的项目使用easyui作为前台的展示框架现在页面中是一个layout布局(分上,左,中)在左边是一些菜单,点击后,在中间部分增加一个tab显示内容而增加的tab里面是显示一些列表数据,列表上面是查询 ...
- EasyUI 添加tab页(iframe方式)(转)
function addTab(title, href,icon){ var tt = $('#tabs'); if (tt.tabs('exists', title)){//如果tab已经存在,则选 ...
- EasyUI 添加tab页(iframe方式)
function addTab(title, href,icon){ var tt = $('#tabs'); if (tt.tabs('exists', title)){//如果tab已经存在,则选 ...
随机推荐
- leetcode 173. Binary Search Tree Iterator
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the ro ...
- WebStorm设置左侧菜单栏背景色和样式
WebStrom一直以来都是默认的白色主题,今天想修改了下主题皮肤,结果导致左侧项目资源栏和顶部菜单栏也变成了黑色,结果无法改变回来,网上查了各种帖子,居然也没找到解决方法,自己研究了半天,终于搞定了 ...
- iOS9开发者测试版下载地址(系转载)
将链接复制后,打开迅雷即可下载!请根据自己的手机型号下载.不需要udid绑定.开发者账号,下载后直接升级即可.请根据自己的手机型号将链接复制 打开迅雷 点击立即下载即可.不过好像Mac版的迅雷下载不了 ...
- Delphi Dll 消息处理
转载:http://blog.csdn.net/lailai186/article/details/8770643 事情的导火线是GIF图片的显示. 在应用程序中, 利用三方的GIFImage.pas ...
- MySQL 查看最大连接数, 当期连接数.
查看最大连接数 select VARIABLE_VALUE from information_schema.GLOBAL_VARIABLES where VARIABLE_NAME='MAX_CONN ...
- [转]Java连接各种数据库的方法
//MySQL: String Driver="com.mysql.jdbc.Driver"; //驱动程序 String URL="jdbc:m ...
- MVC Return View() 和 Return PartialView()的区别
分部视图在action中返回一定要用PartialView(),而不要偷懒使用View(),因为,如果你使用View()渲染视图,系统会认为你是一个标准视图,会为你加个默认的母板页(Layout),除 ...
- Interleaving Positive and Negative Numbers
Given an array with positive and negative integers. Re-range it to interleaving with positive and ne ...
- MVC Create
本文介绍如何在MVC里往数据库中插入新的记录. 这里用到的数据表如下: Employees Step 1: 在Control文件里加入method public ActionResult Create ...
- 【leetcode】Binary Tree Maximum Path Sum
Binary Tree Maximum Path Sum Given a binary tree, find the maximum path sum. The path may start and ...