相关疑难解决方法(0)

数据表:更改表的高度不起作用

我正在使用一个带有bPaginate = false的Jquery Datatables表,而sScrollY是一些固定的高度.最终我希望表在window.resize事件上调整大小.

为了实现这一点,我构建了一个较小的测试用例:在下面的代码片段中,我希望在单击按钮时调整表的大小

HTML:

<!DOCTYPE html>
<html>
<head>
<link class="jsbin" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"></script>
<script type="text/javascript" language="javascript" src="http://www.datatables.net/release-datatables/media/js/jquery.dataTables.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  <input id="button" type="button" value="Click me!" />
  <table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
    <thead>
        <tr>
            <th>Rendering engine</th>

            <th>Browser</th>
            <th>Platform(s)</th>
            <th>Engine version</th>
            <th>CSS grade</th>
        </tr>
    </thead>
    <tbody>
        <tr class="odd gradeX">
            <td>Trident</td>
            <td>Internet
                 Explorer 4.0</td>
            <td>Win 95+</td>
            <td class="center"> 4</td>
            <td class="center">X</td>

        </tr>
        <tr class="even gradeC">
            <td>Trident</td>
            <td>Internet
                 Explorer 5.0</td> …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery datatables

10
推荐指数
1
解决办法
3万
查看次数

标签 统计

datatables ×1

html ×1

javascript ×1

jquery ×1