响应表在填充时失去响应性

时间:2014-10-06 18:21:05

标签: javascript jquery html jquery-mobile

我有一个JQuery Mobile响应表。调整浏览器窗口大小时,会显示更多/更少的列,因此一切正常。 http://jsfiddle.net/BamBamm/fe4ppftm/1/

<table data-role="table" data-mode="columntoggle" class="ui-responsive" id="customerTable">
  <thead>
    <tr>
      <th data-priority="6">customer ID</th>
      <th>Customer name</th>
      <th data-priority="1">First name</th>
      <th data-priority="2">Address</th>
      <th data-priority="3">City</th>
      <th data-priority="4">PostalCode</th>
      <th data-priority="5">Country</th>
    </tr>
  </thead>
  <tbody id="customerTableBody">
    <tr>
      <td>10801</td>
      <td>Some name</td>
      <td>Some firt name</td>
      <td>Some address</td>
      <td>London</td>
      <td>123456</td>
      <td>United Kingdom</td>
    </tr>
  </tbody>
</table>

当我尝试动态填充表时,响应表在调整浏览器大小时不再响应。我通过设置表体的html代码来填充表格: http://jsfiddle.net/BamBamm/e2ukzy5z/1/

tableBody = "<tr><td>10801</td> <td>Some name</td> <td>Some firt name</td> <td>Some address</td> <td>London</td> <td>123456</td> <td>United Kingdom</td> </tr>";
$('#customerTableBody').html(tableBody); 

我该怎么做才能使这项工作?

1 个答案:

答案 0 :(得分:0)

我认为你必须在添加新行后调用Refresh。

$('#customerTable')。table(“refresh”)

https://github.com/jquery/jquery-mobile/issues/5570

相关问题