- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用数据表显示表格内容,除了按钮之外一切正常。他们没有出现。
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.2.4/css/buttons.dataTables.min.css">
<script type="text/javascript" src="//code.jquery.com/jquery-1.12.4.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.2.4/js/dataTables.buttons.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js"></script>
<script type="text/javascript" src="//cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/pdfmake.min.js"></script>
<script type="text/javascript" src="//cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/vfs_fonts.js"></script>
<script type="text/javascript" src="//cdn.datatables.net/buttons/1.2.4/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.0.3/js/buttons.html5.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#example').DataTable( {
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
} );
} );
</script>
<div id="content" class="span10">
<div class="row-fluid sortable">
<div style="height: 80px;"> <a href="<?php echo BASEURL;?>index.php/welcome/mismatchPatch">>>Details of DB which is not matching</a></div>
<a href="#" id="test" onClick="javascript:fnExcelReport();">download</a>
<table class="display" id="example" cellspacing="0" width="100%">
<!-- <th>HOSTNAME</th>
<?php foreach($patchData2 as $tes){?>
<th> <?php echo $tes->VERSION;?></th>
<th>PATCH</th>
<?php } ?>-->
<thead>
<tr>
<th>HOSTNAME</th>
<th>10.2.0.4.0</th>
<th>10.2.0.5.0</th>
<th>11.2.0.1.0</th>
<th>11.2.0.2.0</th>
<th>11.2.0.3.0</th>
<th>11.2.0.4.0</th>
<th>12.1.0.2.0</th>
</tr>
</thead>
<tfoot>
<tr>
<th>HOSTNAME</th>
<th>10.2.0.4.0</th>
<th>10.2.0.5.0</th>
<th>11.2.0.1.0</th>
<th>11.2.0.2.0</th>
<th>11.2.0.3.0</th>
<th>11.2.0.4.0</th>
<th>12.1.0.2.0</th>
</tr>
</tfoot>
<tbody>
<?php foreach($patchData1 as $tes){
?>
<tr><!-- class = " <?php if(checkfunction($tes['HOSTNAME'],$tes['10.2.0.4.0'],$patchData3)== TRUE) { echo "red_color" ; } ?> "> -->
<td><?php echo $tes['HOSTNAME'];?></td>
<td class = "<?php if(checkfunction($tes['HOSTNAME'],'10.2.0.4.0',$patchData3)== TRUE) { echo 'cellClass' ; } elseif(!empty($tes['10.2.0.4.0'])) { echo 'cellsClass'; } ?> "><?php if (!empty($tes['10.2.0.4.0'])){ echo "Patch 49"; }?></td>
<td class = "<?php if(checkfunction($tes['HOSTNAME'],'10.2.0.5.0',$patchData3)== TRUE) { echo 'cellClass' ; } elseif(!empty($tes['10.2.0.5.0'])) { echo 'cellsClass'; } ?> "><?php if (!empty($tes['10.2.0.5.0'])){ echo "Patch 29"; }?></td>
<td class = "<?php if(checkfunction($tes['HOSTNAME'],'11.2.0.1.0',$patchData3)== TRUE) { echo 'cellClass' ; } elseif(!empty($tes['11.2.0.1.0'])) { echo 'cellsClass'; }?> "><?php if (!empty($tes['11.2.0.1.0'])){ echo "Patch 13"; }?></td>
<td class = "<?php if(checkfunction($tes['HOSTNAME'],'11.2.0.2.0',$patchData3)== TRUE) { echo 'cellClass' ; } elseif(!empty($tes['11.2.0.2.0'])) { echo 'cellsClass'; } ?> "><?php if (!empty($tes['11.2.0.2.0'])){ echo "Patch 27"; }?></td>
<td class = "<?php if(checkfunction($tes['HOSTNAME'],'11.2.0.3.0',$patchData3)== TRUE) { echo 'cellClass' ; } elseif(!empty($tes['11.2.0.3.0'])) { echo 'cellsClass'; }?> "><?php if (!empty($tes['11.2.0.3.0'])){ echo "11.2.0.3 BP 39"; }?></td>
<td class = "<?php if(checkfunction($tes['HOSTNAME'],'11.2.0.4.0',$patchData3)== TRUE) { echo 'cellClass' ; } elseif(!empty($tes['11.2.0.4.0'])) { echo 'cellsClass'; }?> "><?php if (!empty($tes['11.2.0.4.0'])){ echo "WinBundle 11.2.0.4.161018"; }?></td>
<td class = "<?php if(checkfunction($tes['HOSTNAME'],'12.1.0.2.0',$patchData3)== TRUE) { echo 'cellClass' ; } elseif(!empty($tes['12.1.0.2.0'])) { echo 'cellsClass'; }?> "><?php if (!empty($tes['12.1.0.2.0'])){ echo "12.1.0.2.160719OJVMPSU"; }?></td>
<!--bgcolor="#FF0000"-->
</tr>
<?php } ?>
<?php
function checkfunction($host,$version,$patchData3)
{
foreach($patchData3 as $tes3){
if($tes3->HOSTNAME==$host && $tes3->VERSION==$version ){
return TRUE;
}
}
}
?>
<?php// print_r($patchData3)?>
</tbody>
</table>
</div></div>
<!--
<script type="text/javascript" language="javascript" class="init">
var oTable;
$(document).ready(function() {
$('#form').submit( function() {
var sData = $('input', oTable.fnGetNodes()).serialize();
alert( "The following data would have been submitted to the server: \n\n"+sData );
return false;
} );
oTable = $('#example').dataTable();
} );
</script> -->
<!--
<script type="text/javascript">
var allTableCells = document.getElementsByTagName("td");
for(var i = 0, max = allTableCells.length; i < max; i++) {
var node = allTableCells[i];
//get the text from the first child node - which should be a text node
var currentText = node.childNodes[0].nodeValue;
//check for 'one' and assign this table cell's background color accordingly
//currentText ==='Patch 45'||currentText ==='Patchset 11.2.0.2.0'
if (currentText ==='Patch 45'||currentText ==='Patchset 11.2.0.2.0'||currentText ==='11.2.0.3 BP 36'||currentText ==='12.1.0.2.1607190JVMPSU'||currentText ==='12.1.0.2.0')
node.style.backgroundColor = "red";
}
</script>
.red_color, .red_color td{ color: red; }
-->
<style>
.cellClass { background-color: red ;color: white}
</style>
<style>
.cellsClass { background-color: green;color: white }
</style>
<script type="text/javascript">
function fnExcelReport() {
var tab_text = '<html xmlns:x="urn:schemas-microsoft-com:office:excel">';
tab_text = tab_text + '<head><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet>';
tab_text = tab_text + '<x:Name>Test Sheet</x:Name>';
tab_text = tab_text + '<x:WorksheetOptions><x:Panes></x:Panes></x:WorksheetOptions></x:ExcelWorksheet>';
tab_text = tab_text + '</x:ExcelWorksheets></x:ExcelWorkbook></xml></head><body>';
tab_text = tab_text + "<table border='1px'>";
tab_text = tab_text + $('#example').html();
tab_text = tab_text + '</table></body></html>';
var data_type = 'data:application/vnd.ms-excel';
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {
if (window.navigator.msSaveBlob) {
var blob = new Blob([tab_text], {
type: "application/csv;charset=utf-8;"
});
navigator.msSaveBlob(blob, 'Test file.xls');
}
} else {
$('#test').attr('href', data_type + ', ' + encodeURIComponent(tab_text));
$('#test').attr('download', 'Test file.xls');
}
}
</script>
最佳答案
尝试添加
<script type='text/javascript' src="https://cdn.datatables.net/buttons/1.2.4/js/buttons.print.min.js"></script>
当我添加它时,它开始为我工作。
在这里找到信息:https://datatables.net/extensions/buttons/examples/print/simple.html
关于javascript - 按钮未显示在 Dom :'Bfrtip' 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41727293/
关闭。这个问题是opinion-based .它目前不接受答案。 想要改进这个问题? 更新问题,以便 editing this post 可以用事实和引用来回答它. 关闭 6 年前。 Improve
Polymer的light DOM和local DOM有什么区别?来自文档(1): The DOM that an element creates and manages is called its
当内容添加到网页时,我需要触发一个 Action 。更新可能具有不同的性质(例如 AJAX、延迟脚本、用户操作)并且不受我的控制。 我想使用 DOM 突变事件,但它们并非在所有浏览器中都可用。是否有为
我刚遇到一个有趣的情况,我有一个提交 放置在 内的 native 自定义元素的 Shadow DOM 内. Select #shadow-root ...
假设有一个滚动列表,当我插入一些新的 DOM 附加到当前 dom 时,它工作正常。上拉 但是如果我之前插入一些新的 DOM,新的 DOM 将在视口(viewport)中,而旧的 DOM 将被下推。下拉
在我的项目中实现 Shadow DOM 是否会使它们像 React 使用的虚拟 DOM 一样更快? 最佳答案 它们是不同用途的不同事物,因此比较性能没有意义。 虚拟 DOM 虚拟 DOM 旨在避免对
在我的页面内容上,我将多张卡片组织成网格 __________________ | ____ ____ | | | | | | | | | | | |
是否可以在浏览器中看到(调试)从 DOM 元素触发的自定义事件? 假设我想查看 Bootstrap Collapse 的哪个特定元素触发了 show.bs.collapse event ,我能以某种方
我正在生成用于客户端的 XPaths 服务器端,我很困惑为什么在 DOM 中找不到表路径(即 td 中的内容)。 事实证明,现代浏览器(至少是 Chrome 和 Firefox)插入了 tbody在文
是否可以检索文本节点的几何位置(即从父元素、页面等的顶部/左侧偏移量)? 最佳答案 不是直接的。 TextNode 没有用于测量视口(viewport)定位的原始 IE 偏移*(和类似的)扩展。 仅在
以下语句中的 DOM 元素的含义是什么? Statement #1 You can add multiple classes to a single DOM element. Statement #2
有没有办法让 firebug(或任何其他浏览器,或使用任何其他工具)阻止任何 dom 操作的发生?有时布局调试充满悬停事件的屏幕是不可能的,因为元素可能会消失,并且您看不到它们的复合布局。 最佳答案
我需要在html文档中搜索 text here 然后输出完整的节点路径(CSS或XPATH) 例如 html > body > div class ="something" > table > tr
这是我的一个页面的典型加载时间如何拆分为:- Domain Lookup 0 0 % Connect 134 .3% Request
我的 .on() 工作时遇到一些问题。我的网站是here . 如果你看看 www.eliteweb-creation.co.uk/dev/js/nav.js,我正在 mouseenter 和 mous
我是 Javascript 的新手,负责将我们产品的 UI 从 YUI2 迁移到 YUI3。看起来哪里都没有迁移指南,所以我现在正在浏览互联网帖子和 yui 文档。 在我的全局范围内,我临时添加了类似
我想和实习生一起测试一些 DOM 相关的东西,不需要特定的固定装置,只是一般的 DOM 东西,比如我改变了 Element.prototype。这是否需要通过本地 Selenium 服务器(或 sau
我是 HTML 和 HTML5 的初学者。 当我阅读以下内容时 link ,我找到了术语 DOM 和 DOM API。我通读了维基百科,但无法理解其背后的全部思想。 谁能给我解释一下: 文档对象模型
我有两个主要问题。 Object 之类的扩展是否算数? 什么是 DOM 包装? http://perfectionkills.com/whats-wrong-with-extending-the-do
对不起查询,原型(prototype),雅虎 YUI,道场在考虑小的时候不吸引我。我想要一个模块化的库,代码尽可能小,最多 20Kb [un compressed] 是我所期望的。应该提供 Dom 操
我是一名优秀的程序员,十分优秀!