【发布时间】:2011-01-03 16:50:47
【问题描述】:
我正在使用DataTables 修饰我用来显示基于 XSL 转换的 XML 结果的表。我从技术角度(分页、排序、过滤)完成了所有工作,但我正在尝试使用 ThemeRoller 主题使其看起来像他们网站上的内容。
到目前为止,我已将以下文件及其引用添加到我的项目中:
<link type="text/css" href="css/custom-theme/jquery-ui-1.8.7.custom.css" rel="stylesheet"/>
并根据 DataTables 网站使用以下内容启用 ThemeRoller 主题:
$(document).ready(function() {
$('#mainTable').dataTable( {
"bJQueryUI": true,
"sPaginationType": "two_button"
});
});
表格已设置样式,但由于标题行太宽且内容位于应位于一行的多行,它看起来不正确。关于我做错了什么的任何迹象?提前非常感谢。
HTML 代码:
<html>
<body>
<head runat="server">
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<link type="text/css" href="css/custom-theme/jquery-ui-1.8.7.custom.css" rel="stylesheet">
<script src="Scripts/jquery-1.4.4.min.js" type="text/javascript">
</script>
<script src="Scripts/jquery.dataTables.min.js" type="text/javascript">
</script>
<script type="text/javascript">
$(document).ready(function() {
$('#example').dataTable( {
"bJQueryUI": true
});
});
</script>
</head>
<table cellpadding="0" cellspacing="0" border="0" id="example" class="display">
<thead>
<tr>
<th>
<h3>Title</h3>
</th>
<th>
<h3>URL</h3>
</th>
<th>
<h3>Notes</h3>
</th>
<th>
<h3>
</h3>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.roperband.com">Jesse\'s Article</a>
</td>
<td>
<a href="http://www.roperband.com">http://www.roperband.com</a>
</td>
<td>Some of Jesse\'s notes</td>
<td>
</td>
</tr>
</tbody>
</table>
</body>
</html></span>
</div>
<div class="clear">
</div>
<div class="footer">
</div>
</form>
</body>
</html>
【问题讨论】:
-
@Music Magi:有什么办法可以张贴出问题的屏幕截图吗?
-
能把html表格代码放上来吗?
-
@Andrew imgur.com/BcNtZ
-
看起来像标题单元格周围的填充是导致它看起来那样的原因。我还会检查字体大小。快速测试—— .ui-widget-header { padding:0px; }
-
好的,但是您能否将生成的 HTML 放入浏览器中?谢谢。如果你使用 Chrome,你可以检查元素并获取 html。
标签: jquery html css datatables