Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery Mobile Table

Can anyone point me to any sample or can provide any sample of a Jquery Mobile table please?

I've seen the demos on their website and found no tables.

I need to be able to create a table that will look good on Mobile / iPad.

like image 839
Satch3000 Avatar asked Apr 19 '11 21:04

Satch3000


3 Answers

http://jquerymobile.com/demos/1.0a4.1/#docs/forms/../../docs/content/content-html.html right click and view source:

<table summary="This table lists all the JetBlue flights."> 
  <caption>Travel Itinerary</caption> 
  <thead> 
    <tr> 
       <th scope="col">Flight:</th>  
      <th scope="col">From:</th>  
      <th scope="col">To:</th>  
    </tr> 
  </thead> 
  <tfoot> 
    <tr> 
      <td colspan="5">Total: 3 flights</td> 
    </tr> 
  </tfoot> 
  <tbody> 
  <tr> 
    <th scope="row">JetBlue 983</th> 
    <td>Boston (BOS)</td> 
    <td>New York (JFK)</td> 
  </tr> 
  <tr> 
    <th scope="row">JetBlue 354</th> 
    <td>San Francisco (SFO)</td> 
    <td>Los Angeles (LAX)</td> 
  </tr> 
<tr> 
    <th scope="row">JetBlue 465</th> 
    <td>New York (JFK)</td> 
    <td>Portland (PDX)</td> 
  </tr> 
  </tbody> 
</table> 

CSS

<style type="text/css"> 
    table { width:100%; }
    table caption { text-align:left;  }
    table thead th { text-align:left; border-bottom-width:1px; border-top-width:1px; }
    table th, td { text-align:left; padding:6px;} 
</style> 

Updating the Links:

  • http://jquerymobile.com/demos/1.2.0/docs/content/content-html.html
  • http://jquerymobile.com/branches/swipe/docs/tables/index.html ( beta )
like image 59
Phill Pafford Avatar answered Oct 19 '22 22:10

Phill Pafford


Try this layout instead

<ul>
<li> <!--first item -->
    <table>
        <tr>
            <td>Heading1</td>
            <td>Meaning1</td>
        </tr>
        <tr>
            <td>Heading2</td>
            <td>Meaning2</td>
        </tr>
        <tr>
            <td>Heading3</td>
            <td>Meaning3</td>
        </tr>
    </table>
</li>
<li> <!-- second item -->
    <table>
        <tr>
            <td>Heading1</td>
            <td>Meaning1</td>
        </tr>
        <tr>
            <td>Heading2</td>
            <td>Meaning2</td>
        </tr>
        <tr>
            <td>Heading3</td>
            <td>Meaning3</td>
        </tr>
    </table>
</li>
</ul>

and the css

ul {
    width: 100%;    
    margin-left: 0px;
    padding: 0px; 
}

ul li {
    list-style-type: none;
    border-bottom: 1px dashed gray;
    margin-top: 10px; 
}

*fixed small bugs but have to add this to make substantial edit

like image 27
Alex Avatar answered Oct 19 '22 21:10

Alex


And if you want a crazy alternative you can always create a listview with grids in it. It might look interesting.

like image 35
naugtur Avatar answered Oct 19 '22 21:10

naugtur