【问题标题】:Error with data-role="table" jquery-mobiledata-role="table" jquery-mobile 出错
【发布时间】:2013-07-29 10:32:44
【问题描述】:

我正在使用表格进行布局。但是使用 data role="table" 我收到以下错误:

“未捕获的类型错误:无法调用未定义的方法'not'”。

我正在使用 jquery-1.9.1.min.js;

jquery-ui.min.js;

jquery.mobile-1.3.1.min.js 版本。

如果我删除数据角色,那么表结构就会受到影响。我应该如何避免使用数据角色表选项出现此错误?

empDetails += '<table data-role="table" id="table-custom-2" border="0" >';
        empDetails += '<tbody><tr><td colspan="100%"><img id="emailimg" src="images/email.png" class="imgshape"><IMG style="width:25px;height:5px;vertical-align:middle" SRC="images/spacer.gif" />';
        empDetails += stremail+'</span></a></td></tr>';
        empDetails += '<tr><td colspan="100%"><img id="emailimg" src="images/tel.png" class="imgshape"><IMG style="width:25px;height:5px;vertical-align:middle" SRC="images/spacer.gif" />';
        empDetails += strphone+'</td></tr>';
        empDetails += '<tr><td colspan="100%"><img id="emailimg"   src="images/cell.png" class="imgshape"><IMG style="width:25px;height:5px;vertical-     align:middle" SRC="images/spacer.gif" />';
        empDetails += strcellphone+'</td></tr>';

        empDetails += '</tbody></table>';

        $('#userdetails').html(empDetails);     

马格什

【问题讨论】:

  • 你能展示你的实际代码吗?
  • 我怀疑这会引发错误...将您的相关代码发布到..
  • 确保您的 jQuery Mobile 和 jQuery 版本兼容,并确保您没有在同一页面中使用任何其他版本。
  • 尝试在代码中添加 。
  • 关于这个问题的任何更新。我还没有解决这个问题。

标签: jquery jquery-mobile html-table


【解决方案1】:

尝试添加以下行:

empDetails += '<table data-role="table" id="table-custom-2" border="0" >';    
empDetails += '<thead><tr><th></th></tr></thead>';
...

【讨论】:

    【解决方案2】:

    当表具有 data-role="table" 时,在 jquery mobile 中使用以下格式 属性:

     <table data-role="table" id="table-column-toggle" data-mode="columntoggle" class="ui-responsive table-stroke">
                  <thead>
                    <tr>
                      <th data-priority="2">Rank</th>
                      <th>Movie Title</th>
                      <th data-priority="3">Year</th>
                      <th data-priority="1"><abbr title="Rotten Tomato Rating">Rating</abbr></th>
                      <th data-priority="5">Reviews</th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr>
                      <th>1</th>
                      <td><a href="http://en.wikipedia.org/wiki/Citizen_Kane" data-rel="external">Citizen Kane</a></td>
                      <td>1941</td>
                      <td>100%</td>
                      <td>74</td>
                    </tr>
                    <tr>
                      <th>2</th>
                      <td>Casablanca</td>
                      <td>1942</td>
                      <td>97%</td>
                      <td>64</td>
                    </tr>
              </tbody>
    </table>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-12-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多