如何隐藏表中的列切换按钮?

Mon*_*ago 9 jquery tablesorter jquery-mobile

我想隐藏表格上方的表格中的列切换按钮或列选择器按钮.我正在使用jQuery Mobile ver.1.3.2.

我正在使用这个:

<table data-role="table" id="table-column-toggle" data-mode="columntoggle" class="ui-responsive table-stroke">
 <thead class="pearlHeading">
  <tr>
   <th data-priority="1">S.No.</th>
   <th >Name of the Programme</th>
   <th data-priority="2">Campus</th>
  </tr>
 </thead>
 <tbody>
 </tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

我删除了

data-role="table" id="table-column-toggle" data-mode="columntoggle"
Run Code Online (Sandbox Code Playgroud)

但它不能正常工作

Him*_*hra 13

我的更专业,使用:

data-mode="columntoggle:none"

工作实例:

<!DOCTYPE html>
<html>

<head>
  <title>jQM Complex Demo</title>
  <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
  <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=no; target-densityDpi=device-dpi" />
  <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
  <!--<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>-->
  <script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
</head>

<body>
  <div data-role="page" id="index">
    <div data-theme="b" data-role="header">
      <h1>Index page</h1>
    </div>

    <div data-role="content">
      <table data-role="table" id="table-column-toggle" data-mode="columntoggle:none" class="ui-responsive table-stroke">
        <thead class="pearlHeading">
          <tr>
            <th data-priority="1">S.No.</th>
            <th>Name of the Programme</th>
            <th data-priority="2">Campus</th>
          </tr>
        </thead>
        <tbody>
        </tbody>
      </table>
    </div>
  </div>
</body>

</html>
Run Code Online (Sandbox Code Playgroud)

http://jsfiddle.net/Lsoesxtv/1/

  • 这应该是公认的答案。@Gajotres 回答隐藏了所有切换按钮。这可以防止它在特定表上呈现。感谢海星! (2认同)

Gaj*_*res 11

工作示例:http://jsfiddle.net/Gajotres/pdYre/

CSS:

.ui-table-columntoggle-btn {
    display: none !important;
}
Run Code Online (Sandbox Code Playgroud)