Why simple jQuery mobile table shown transposed? -
put on page sample (and simple) table:
<table id="mytable"> <thead> <tr> <th>column 1</th> <th>column 2</th> <th>column 3</th> </tr> </thead> <tbody> <tr> <td>row 1 column 1</td> <td>row 1 column 2</td> <td>row 1 column 3</td> </tr> <tr> <td>row 2 column 1</td> <td>row 2 column 2</td> <td>row 2 column 3</td> </tr> </tbody> </table> no surprise in showing - header row, trs inside body - rows. @ this:
column 1 column 2 column 3 row 1 column 1 row 1 column 2 row 1 column 3 row 2 column 1 row 2 column 2 row 2 column 3 then trying make table jquery-styled - add data-role="table" table tag. surprise - table whown transposed: 1) head column (!) 2) rows columns. @ this:
column 1row 1 column 1 column 2row 1 column 2 column 3row 1 column 3 column 1row 2 column 1 column 2row 2 column 2 column 3row 2 column 3 is default behaviour? what's up? how force jquery table being normal?
there 2 data-mode's' default reflow, wherein collapses table columns stacked presentation looks blocks of label/data pairs each row. behavior evident in mobile devices, in deskop/tablet normal table.
large tables lots of columns don't fit on smaller screens, hence there mode called columntoggle allows user toggle columns.
however in order have default table structure seen in desktop browser either rid of data-role attribute or set data-role='none'
put data-mode="columntoggle"
<table data-role="table" id="my-table" data-mode="columntoggle"> <thead> <tr> <th>column 1</th> <th>column 2</th> <th>column 3</th> </tr> </thead> <tbody> <tr> <td>row 1 column 1</td> <td>row 1 column 2</td> <td>row 1 column 3</td> </tr> <tr> <td>row 2 column 1</td> <td>row 2 column 2</td> <td>row 2 column 3</td> </tr> </tbody> </table> add following styles hide column button:
.ui-table-columntoggle-btn { display: none;}
Comments
Post a Comment