jQuery Mobile - Table Reflow


You can represent the data in a horizontal format by collapsing the table into a stacked representation. This groups the rows into a vertical format using the data-mode = "reflow" attribute.


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

<!DOCTYPE html>
      <title>Table Reflow</title>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <link rel = "stylesheet" href = "http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
      <script src = "http://code.jquery.com/jquery-1.11.3.min.js"></script>
      <script src = "http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
      <div data-role = "header">
      <table data-role = "table" id = "table_columns" data-mode = "reflow" 
         class = "ui-responsive">
               <th data-priority = "1">Position</th>
               <th data-priority = "2">Rating</th>
               <th data-priority = "3">Points</th>
               <td>SOUTH AFRICA</td>
               <td>NEW ZEALAND</td>
               <td>SRI LANKA</td>
               <td>WEST INDIES</td>
      <div data-role = "footer">


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

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

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

Kickstart Your Career

Get certified by completing the course

Get Started