mootools 1.4.0.1 - htmltable push

时间:2015-02-15 10:17:29

标签: row push mootools add

根据 http://mootools.net/more/docs/1.5.1/Interface/HtmlTable#HtmlTable 我使用push来添加新行,包含一些属性和定位。

这是一个片段:

var table = new HtmlTable($('my_table_id')); 
var target  = "some code...";
table.push([
                td_val1,
                td_val2,
                td_val3,
                td_val4,
                { 
                    content: td_val5,
                    properties: {
                        'class': 'my_class'
                    }
                },
                td_val6,
            ], 
        (target !== undefined) ? {} : null, 
        (target !== undefined) ? target.parentNode : null, 
        (target !== undefined) ? 'td' : null, 
        (target !== undefined) ? 'after' : null
);

它适用于像(table.empty()之前的空表):

<table id="my_table_id">
    <thead>
        <tr>
            <th>Col1</th>
            <th>Col2</th>
            <th>Col3</th>
            <th>Col4</th>
            <th>Col5</th>
            <th>Col6</th>
            <th>Col7</th>
            <th>Col8</th>
        </tr>
    </thead>
    <tbody>
        <tr class="no_result">
            <td colspan="8">No results</td>
        </tr>
    </tbody>
</table>

但对预填表没有影响,如:

<table id="my_table_id">
    <thead>
        <tr>
            <th>Col1</th>
            <th>Col2</th>
            <th>Col3</th>
            <th>Col4</th>
            <th>Col5</th>
            <th>Col6</th>
            <th>Col7</th>
            <th>Col8</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>val1</td>
            <td>val2</td>
            <td>val3</td>
            <td>val4</td>
            <td>val5</td>
            <td>val6</td>
            <td>val7</td>
            <td>val8</td>
        </tr>
    </tbody>
</table>

推送代码在try / catch中,但没有引发异常。

我没有把问题集中在是什么......非常感谢你的帮助。

0 个答案:

没有答案
相关问题