jQuery Mobile - Table Reflow Heading Groups



Description

Displays the column headings as sub headings between the data sets and represents the data in terms of value pairs using data-mode = "reflow" attribute.

Example

Following example demonstrates the use of table reflow heading groups in the jQuery Mobile Framework.

<!DOCTYPE html>
<html>
   <head>
      <title>Table Reflow Heading Group</title>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <link rel = "stylesheet" href = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
      <script src = "https://code.jquery.com/jquery-1.11.3.min.js"></script>
      <script src = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
   </head>

   <body>
      <div data-role = "header">
         <h2>Header</h2>
      </div>
      
      <table data-role = "table" id = "table_columns" data-mode = "reflow" 
         class = "table-stroke">
         <thead>
            <tr class = "th-groups">
               <th></th>
               <th colspan = "3" data-priority = "4">INDIA</th>
               <th colspan = "3" data-priority = "3">AUSTRALIA</th>
               <th colspan = "3" data-priority = "2">ENGLAND</th>
            </tr>
            
            <tr>
               <th>Played</th>
               <th>Won</th>
               <th>Loss</th>
               <th>Played</th>
               <th>Won</th>
               <th>Loss</th>
               <th>Played</th>
               <th>Won</th>
               <th>Loss</th>
            </tr>
         </thead>
         
         <tbody>
            <tr>
               <th>Sydney</th>
               <td>20</td>
               <td>14</td>
               <td>6</td>
               <td>15</td>
               <td>10</td>
               <td>5</td>
               <td>10</td>
               <td>3</td>
               <td>7</td>
            </tr>
            
            <tr>
               <th>Eden Gardens</th>
               <td>10</td>
               <td>9</td>
               <td>1</td>
               <td>8</td>
               <td>3</td>
               <td>5</td>
               <td>9</td>
               <td>5</td>
               <td>4</td>
            </tr>
            
            <tr>
               <th>Oval</th>
               <td>12</td>
               <td>9</td>
               <td>3</td>
               <td>15</td>
               <td>3</td>
               <td>12</td>
               <td>20</td>
               <td>15</td>
               <td>5</td>
            </tr>
         </tbody>
      </table>
      
      <div data-role = "footer">
         <h2>Footer</h2>
      </div>
      
   </body>
</html>

Output

Let's carry out the following steps to see how the above code works −

  • Save the above html code as jqm_table_reflow_heading_groups.html file in your server root folder.

  • Open this HTML file as http://localhost/jqm_table_reflow_heading_groups.html and the following output will be displayed.

jquery_mobile_widgets.htm
Advertisements