How to hide the column-toggle button from the table?
Asked Answered
M

4

9

I want to hide the column-toggle button or column chooser button from the table appears above the table. I am using the jQuery Mobile ver. 1.3.2.

i'm using this:

<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>

I remove the

data-role="table" id="table-column-toggle" data-mode="columntoggle"

but its not working properly

Mita answered 23/7, 2013 at 8:19 Comment(0)
R
11

Working example: http://jsfiddle.net/Gajotres/pdYre/

CSS:

.ui-table-columntoggle-btn {
    display: none !important;
}
Revanche answered 23/7, 2013 at 8:21 Comment(1)
hey bro can u please help me on this question : #17783023Mita
G
13

Mine more professional, Use :

data-mode="columntoggle:none"

Working Example:

<!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>

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

Giuditta answered 13/3, 2015 at 13:8 Comment(1)
This should be the accepted answer. @Gajotres answer hides all toggle buttons. This prevents it from rendering on the specific table. Thanks Himstar!Worried
R
11

Working example: http://jsfiddle.net/Gajotres/pdYre/

CSS:

.ui-table-columntoggle-btn {
    display: none !important;
}
Revanche answered 23/7, 2013 at 8:21 Comment(1)
hey bro can u please help me on this question : #17783023Mita
D
2

I've found a simpler solution

1) Declare the following CSS class

.ui-btn-z {
    display: none !important;
}

2) Set this attribute on the table tag

data-column-btn-theme="z"

That should be it :)

Dizen answered 20/8, 2014 at 3:15 Comment(0)
F
0

I use the response of "Gajotres" but ...

applies to all "buttons table toggle" and you could not "choose" which apply, if you edit .js it a bit :

jquery.mobile - 1.3.2.min.js (gzip) line 6 column 11429

d=a(k.columnBtnText===""?"":"<a href='#"+m+"' class='"+k.classes.columnBtn+"' data-"+l+"rel='popup' data-"+l+"mini='true'>"+k.columnBtnText+"</a>")

jquery.mobile - 1.3.2.js line 10872

if ( event ! == " refresh" ) {
self.element.addClass ( o.classes.columnToggleTable ) ;
if ( o.columnBtnText === "") {
$MenuButton = $(""),
else {
$menuButton = $("<a href='#" + id + "' class='" + o.classes.columnBtn + "' data-" + ns         + "rel='popup' data-" + ns + "mini='true'>" + o.columnBtnText + "</a>" ),
}
$ popup = $ (" < div data- " + ns + " role = ' popup' data- " + ns + " role = ' fieldcontain ' class = '" + o.classes.popup + " ' id = ' " + id + "' > < / div >") ,
$ menu = $ (" + ns + <fieldset data-" "role='controlgroup'> < / fieldset >") ;

the code does ? , if the "text" button is blank data-column-btn-text=""... does not show the button and thus can decide which to display and which to hide

then only a little editing . js no longer need the css and you can choose where you hide the button

Footwear answered 31/3, 2014 at 15:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.