表列切换UI未刷新

问题描述 投票:0回答:1

在jquery mobile v 1.4.5中,使用列toogle选项动态添加表行。最初将列添加到列,然后添加动态行,这会在UI中隐藏选定的行,但会检查切换弹出元素。

<table id="tab" data-role="table" data-mode="columntoggle" class="ui-responsive">
    <thead id="th">
        <tr id="tr1">
            <th>First</th>
            <th data-priority="1">Second</th>
            <th data-priority="2">third</th>
            <th data-priority="3">Fourth</th>
        </tr>
    </thead>

看到这个FIDDLE首先单击列按钮启用第四列和第五列,现在单击添加行按钮第四行和第五行从UI隐藏但是再次单击列弹出第四列和第五列被选中。

(由于表刷新,第四和第五列被隐藏,但如果删除刷新,则toogle不适用于动态行)

javascript jquery jquery-mobile
1个回答
0
投票

尝试使用rebuild而不是refresh:

$('#tab').table( "rebuild" );

API Doc:http://api.jquerymobile.com/table/#method-rebuild

更新了FIDDLE

© www.soinside.com 2019 - 2024. All rights reserved.