0

THEADdataTablesで2行を操作することは可能ですか?

<table>
    <thead>
        ## row 1
        ## row 2
    </thead>
    <tbody></tbody>
</table> 

行1には、2つの単一列と1つの列が必要ですcolspan="3"

<tr>
    <th></th>
    <th></th>
    <th colspan="3"></th>
</tr>

そして、行2には5つの列が必要です。

<tr>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
</tr>

しかし、5列ではなく、3列しか必要ない場合があります。

これは動的に生成できますか?

更新:試しました:http://datatables.net/release-datatables/examples/basic_init/complex_header.html

しかし、それがどのように生成されるかについての良い例はありません。

4

1 に答える 1

1

投稿したリンクの例のソース コードを見ると、非常に明確に見えます。

<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
    <thead>
        <tr>
            <th rowspan="2">Rendering engine</th>
            <th rowspan="2">Browser</th>
            <th colspan="3">Details</th>
        </tr>
        <tr>
            <th>Platform(s)</th>
            <th>Engine version</th>
            <th>CSS grade</th>
        </tr>
    </thead>
    <tfoot>
        <tr>
            <th rowspan="2">Rendering engine</th>
            <th rowspan="2">Browser</th>
            <th>Platform(s)</th>
            <th>Engine version</th>
            <th>CSS grade</th>
        </tr>
        <tr>
            <th colspan="3">Details</th>
        </tr>
    </tfoot>

(コードは上記リンクから引用)


ソース コードの表示について: Firefox では、 ctrl+uを押すと、ページのソース コードを表示できます。ページ上で大量の jQuery アクションがある場合でも、そのウィンドウ内のソー​​ス コードは常に DOM の変更がない元のコードになります。

于 2012-07-31T08:16:57.693 に答える