#

Navigation Search

- Accordion
- AJAX Navigation
- Autocomplete
- Buttons
- Checkboxes
- Collapsibles
- Controlgroup
- Dialogs
- Fixed toolbars
- Flip switch toggle
- Footer toolbar
- Form elements
- Grids
- Header toolbar
- Icons
- Links
- Listviews
- Loader overlay
- Navbar
- Navbar, persistent
- Pages
- Panels New
- Popup
- Radio buttons
- Select
- Slider, single
- Slider, dual range New
- Table, column toggle New
- Table, reflow New
- Text inputs & textarea
- Transitions
- Collapsibles
- Dynamic collapsible
- Controlgroups
- Dynamic controlgroup
- Listviews
- Grid Listview
- Autodividers Linkbar
- Autodividers Selector
- Navigation
- Backbone and Require.js example
- Redirection with server-side support
- Panels
- Panel styling
- Open panel on swipe
- Popups
- Dynamic popup
- Popup with arrow
- Responsive Tables
- Reflow: Custom styles
- Reflow: Heading groups
- Reflow: Refresh method
- Column toggle: Customization options
- Column toggle: Heading groups
- Column toggle: Refresh method
- Column toggle demo: Phone comparison
- Sliders
- Tooltip extension
- Swipe
- Swipe to navigate
- Swipe to delete list item
- Forms
- Why won't my CSS styles apply correctly to a widget?
- Updating the value of enhanced form elements does not work.
- My HTML 5 inputs look different across devices and browsers.
- My range or search inputs are being change to number/text.
- Sometimes my custom select shows as a popup other times its a dialog.
- Disabling a button does not work.
- Controls in my fixed header or footer are not responding or behave erratically.
- Pages
- Why aren't my scripts and styles loading?
- Why isn't DOM ready working for my scripts?
- How do I load a page?
- Why is only the first page of my multi page document loaded?
- I'm trying to pass query params to a page but it's not working?
- I'm trying to pass information via the hash but it's not working?
- I'm trying to use the application cache but it's not working.
- Content injected into a page is not enhanced.
- Triggering create on injected HTML does not work.
- How can I stop JQM from auto-enhancing an element?
- How can I stop JQM from enhancing a block of elements?
- How do I control page titles?
- How do I load a page?
- Events
- How do I use touch and mouse events?
- Theme and styling
- How does theming work?
- Apps
- How do I need to configure PhoneGap/Cordova?

# Table: Reflow API

The reflow table mode works by collapsing the table columns into a stacked presentation that looks like blocks of label/data pairs for each row.

## Reflow basics

The reflow responsive table only requires a table with a `data-role="table"` on the table element. There is no need to set the `data-mode` attribute since `reflow` is the default. Be sure to include `thead` and `tbody` elements in your table. This example also uses the preset responsive breakpoint, applied via the `ui-responsive` class.

Rank | Movie Title | Year | Rating | Reviews
--- | --- | --- | --- | ---
1 | Citizen Kane | 1941 | 100% | 74
2 | Casablanca | 1942 | 97% | 64
3 | The Godfather | 1972 | 97% | 87
4 | Gone with the Wind | 1939 | 96% | 87
5 | Lawrence of Arabia | 1962 | 94% | 87
6 | Dr. Strangelove Or How I Learned to Stop Worrying and Love the Bomb | 1964 | 92% | 74
7 | The Graduate | 1967 | 91% | 122
8 | The Wizard of Oz | 1939 | 90% | 72
9 | Singin' in the Rain | 1952 | 89% | 85
10 | Inception | 2010 | 84% | 78

## Making the table responsive

By default, a table with reflow mode will display the stacked presentation style on all screen widths. The styles to make the table responsive are added by applying a media query with rules to switch to the tabular style presentation above a specific screen width.

This is done by wrapping a few simple CSS rules in and a media query that only applies the rules above a certain width breakpoint. The styles make the table header rows visible, display the cells in a tabular format, and hide the generated label elements within each. Here is an example media query that swaps the presentation at 40em (640 pixels):

    @media ( min-width: 40em ) {
    	/* Show the table header rows and set all cells to display: table-cell */
    	.my-custom-breakpoint td,
    	.my-custom-breakpoint th,
    	.my-custom-breakpoint tbody th,
    	.my-custom-breakpoint tbody td,
    	.my-custom-breakpoint thead td,
    	.my-custom-breakpoint thead th {
    		display: table-cell;
    		margin: 0;
    	}
    	/* Hide the labels in each cell */
    	.my-custom-breakpoint td .ui-table-cell-label,
    	.my-custom-breakpoint th .ui-table-cell-label {
    		display: none;
    	}
    }

It's best to use a `class` on the table to apply the breakpoint. Add these rules to your custom stylesheet that is included in the `head` of the page. We recommend creating a set of custom breakpoint classes that can be used to apply standard table breakpoints in your project.

## Choosing a breakpoint

The goal is to determine the minimum width at which the entire table will fit comfortably within the screen. Find this width by populating a table with realistic sample data, then adjust the browser window until the table completely fits and has a bit of extra space to account for rendering differences across devices. This is the natural place to set the breakpoint that switches between the stacked and tabular presentation modes. The breakpoint width is highly dependent on the number of columns in the table and content within each cell.

## Applying a preset breakpoint

Even though we strongly encourage you to write custom breakpoints yourself, the framework includes a single pre-configured breakpoint that targets the stacked style to smaller phones and swaps to a tabular prsentation on larger phones, tablet and desktop devices. To use this preset breakpoint, add the `ui-responsive` class to the table to convert from the stacked presentation to a tabular presentation at 560px (35em). If this breakpoint doesn't work for your content, we encourage you to write a custom breakpoint as descibed above.

    <table data-role="table" class="ui-responsive">

## Grouped column headers

It's fairly common to need to logically group multiple columns together under a heading group for financial or scientific data. The framework can support the most simple version of this by allowing for two rows of table headers (`TH`), with the first row containing simple `colspan` attributes to group the columns below. In this configuration, the framework will add a class to the label of the first cell in each group to allow you to style these differently and provide additional visual hierarchy.