Bootstrap气泡弹出框(Popovers)集成到easyui列表

阅读: 评论:0

Bootstrap气泡弹出框(Popovers)集成到easyui列表

Bootstrap气泡弹出框(Popovers)集成到easyui列表

步骤一、引入bootstrap文件

<link rel="stylesheet" href="../../common/plugins/bootstrap/css/bootstrap.min.css">
<script type="text/javascript" src="../../common/plugins/bootstrap/js/bootstrap.min.js" charset="utf-8"></script>

步骤二、easyui表格

<table id="dg"></table>  

步骤三、javascript代码

表格操作列渲染formatter:

$('#dg').datagrid({    tableId: 'filesTable', //表格Idurl:'datagrid_data.json',    columns:[[    {field: 'fileName', title: '文件名称', width: '100%', align: 'left',halign:'center', formatter: formatOper}]]    
}); 

操作列渲染,加要传递的参数属性及data-toggle='popover'

 //操作列
function formatOper(value, row, index) {return "<a id='"+row.fId+"' data-toggle='popover' data-container='body'>"+ value+ "</a>";         
}

表格加载完成,处理气泡块(传递参数到气泡块渲染)

//表格加载完成,处理渲染的气泡按钮
$("#filesTable").datagrid({onLoadSuccess:function(){$('[data-toggle="popover"]').each(function(){var element=$(this);var id=element.attr("id");//获取按钮渲染的属性,传递给气泡操作块var fval=element.html();var txt=element.html();var hideT;element.popover({trigger:'manual',placement:'bottom',title:txt,html:'true',content:ContentMethod(id,fval),}).on("mouseenter",function(){var _this=this;//解决多个弹框出现的问题clearTimeout(hideT);if(txt!=$(".popover-title").text()){$(".popover-title").parent().css('display','none'); }$(this).popover("show");//$(".popover-title").parent().attr("id");$(this).siblings(".popover").on("mouseleave",function(){$(_this).popover('hide');});}).on("mouseleave",function(){var _this=this;hideT=setTimeout(function(){if(!$(".popover:hover").length){$(_this).popover('hide');}},100);});}); }
});//气泡操作块的展示	
function ContentMethod(id,fval){var tipCon='<div>';tipCon+='<p><a style="color:black;" href="javascript:void(0)" onClick="showFile(''+id+'',0)">在线预览</a></p><hr style="margin-top:0px;margin-bottom:2px;border-bottom:pink 1px dashed;" />';tipCon+='<p><a style="color:black;" href="javascript:void(0)" onClick="downloadFile('' +id+ '')">下载</a></p></div>'return tipCon;
}

本文发布于:2024-01-31 13:59:56,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/170668079629031.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:弹出   气泡   列表   Bootstrap   easyui
留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23