datatable-scroll.mustache revision a3b15d60042c81a524cebb94370e5a234a19d04b
1360N/A <p>Datatables can be made to scroll along the x and y axes. The `DataTableScroll` plugin enables this functionality.</p>
1360N/A <p>The `width` and `height` attributes trigger scrolling along the respective axis, `width` to make the table scroll along the x axis and `height` along the y axis. Setting both `width` and `height` make the table both x and y scrollable.</p>
1360N/A <p><strong>Note:</strong> Scrolling is not currently supported on the Android WebKit browser.
1360N/A<p>This is the `recordset` data that will be used for each example table. The keys in each tables' `columnset` will correspond with the keys in the data.</p>
1360N/A { ANSI: "00000", STATE: "UNITED STATES", TOTAL_POP: 307006550, LAND_AREA: 3537438.44, POP_PER_SQ_MILE: 79.6 },
1360N/A { ANSI: "01000", STATE: "ALABAMA", TOTAL_POP: 4708708, LAND_AREA: 50744, POP_PER_SQ_MILE: 87.6 },
1360N/A { ANSI: "02000", STATE: "ALASKA", TOTAL_POP: 698473, LAND_AREA: 571951.26, POP_PER_SQ_MILE: 1.1 },
1360N/A { ANSI: "04000", STATE: "ARIZONA", TOTAL_POP: 6595778, LAND_AREA: 113634.57, POP_PER_SQ_MILE: 45.2 },
<p>Plug `DataTableScroll` into the `DataTable` instance before the call to `render()`. Configure the plugin to limit the rendered table dimensions by `height` or `width`.</p>
<p>The first table will be configured to scroll on both X and Y axes by setting both `height` and `width`.</p>
var dtScrollingXY = new Y.DataTable.Base({
dtScrollingXY.render("#scrolling-xy");
<p>The `width` and `height` values passed into the `datatable-scroll` plugin determine the scrolling directions on that particular datatable instance. The following rules apply:</p>
<li>If a width and height are both passed in through the configuration object, the datatable will support scrolling in 'x' and 'y' directions.</li>
<li>If only a width is passed in, the datatable will only support x-scrolling, and its height will default to `auto`</li>
<li>If only a height is passed in, the datatable will only support y-scrolling, and its width will default to `auto`</li>
<li>If neither width nor height are passed in, the datatable will not scroll, and both attributes will default to `auto`</li>
<li>Even if a width and height is passed in, the table will not scroll if it can entirely fit into the specified viewport. However, if additional rows are added, scrollbars will be available immediately.</li>