Table rendering issues using jQuery Mobile

时光怂恿深爱的人放手 提交于 2020-01-06 01:53:39

问题


I'm new to jQuery Mobile and I'm trying to render a table with headers in the left column and data on the right column, as demonstraded in jQuery Mobile docs here.

Here's my test code:

<div data-role="page" id="home">
 <div data-role="header" data-theme="b">
  <h1>Header</h1>
 </div>
 <div data-role="content">
  <ul class="subheader" data-role="listview" data-divider-theme="d" data-inset="false">
   <li data-role="list-divider" role="heading">Section</li>
  </ul>
  <table data-role="table" data-mode="reflow">
   <thead>
    <tr>
     <th>Head 1</th>
     <th>Head 2</th>
     <th>Head 3</th>
     <th>Head 4</th>
     <th>Head 5</th>
    </tr>
   </thead>
   <tbody>
    <tr>
     <td>Data 1</td>
     <td>Data 2</td>
     <td>Data 3</td>
     <td>Data 4</td>
     <td>Data 5</td>
    </tr>
   </tbody>
  </table>
 </div>
</div>

Here's as it's rendered on my desktop (Firefox, Mac OS X) - just as I want:

And here's as it's rendered on my mobile device (PhoneGap, Samsung Galaxy S2):

Ermm, what happens? Shoudn't it render <th>'s on first column and <td>'s on second column? Why it didn't happen? What I've to change to accomplish that? Thank you in advance!


回答1:


Found the problem: I was missing HTML5 doctype on the document. Without the doctype, tables wasn't getting reflow style on PhoneGap's embedded browser.



来源:https://stackoverflow.com/questions/15986481/table-rendering-issues-using-jquery-mobile

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!