Skip to content

Commit 29b91ec

Browse files
committed
Merge pull request #92 from angular-ui/grid
Docs on adjustable grid
2 parents c5b3792 + d1f1427 commit 29b91ec

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

README.md

+53
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,59 @@ marked with uiScrollViewport directive, the browser window object will be used a
200200
</ANY>
201201
```
202202

203+
uiScrollTh and uiScrollTd directives
204+
-------------------
205+
###Description
206+
207+
The uiScrollTh and uiScrollTd directives provide a way to build flexible dynamic grids. Handling of grid rows is done by the uiScroll directive itself. In addition to this uiScrollTh and uiScrollTd directive provide tools to programmatically change grid layout, inclduing applying styles to columns, changing column size and order, as well as saving the modifications to the layout and applying previosly saved layouts.
208+
At this point the above functionality is supported only for table based scrollable grids.
209+
210+
###Usage
211+
212+
Here is the basic html template for scrollable grid using the uiScrollTh and uiScrollTd directives. Keep in mind that the height of the scroll viewport (in this case the `<TABLE>` tag) should be constrained. Also make sure that the initial column widths are applied uniformly to both headers (`<TH>`) and cells (`<TD>`)
213+
```html
214+
<TABLE ui-scroll-viewport class="grid">
215+
<THEAD style="display:block">
216+
<TR>
217+
<TH ui-scroll-th class="col1">header 1...</TH>
218+
<TH ui-scroll-th class="col2">header 2...</TH>
219+
...
220+
</TR>
221+
</THEAD>
222+
<TBODY ui-scroll="item in datasource" adapter="adapter">
223+
<TR>
224+
<TD ui-scroll-td class="col1">...</TD>
225+
<TD ui-scroll-td class="col2">...</TD>
226+
...
227+
</TR>
228+
</TBODY>
229+
</TABLE>
230+
```
231+
232+
### Dependencies
233+
234+
The grid directives have the same dependency requirements as the uiScroll directive itself. To use the directives make sure the `ui.scroll.grid` module is on the list of the module dependencies. Also you have to load the dist/ui-scroll-grid.js file in your page.
235+
236+
### Controlling scrollable grid with the GirdAdapter
237+
238+
GridAdapter object (along with ColumnAdapter objects) provides methods and properties to be used to change the scrollable grid layout. A reference to this object is injected as a property named `gridAdapter`in the scroller adapter.
239+
240+
`GridAdapter` object implements the following properties:
241+
242+
* Property `columns` - returns an array of ColumnAdapter objects to be used to control the scrollable grid layout. The columns are listed in the same order as they appear in the browser.
243+
244+
`GridAdapter` object implements the following methods:
245+
246+
* Method `getLayout()` - returns an object describing current scrollable grid layout.
247+
* Method `applyLayout(layout)` - restores scrollabel grid layout to the state as defined by the object passed as the parameter
248+
* Method `columnFromPoint(x,y)` - if the coordinates belong to a scrollable grid column returns the appropriate ColumnAdapter object. Otherwise returns `undefined`.
249+
250+
`ColumnAdapter` object implements the following methods:
251+
252+
* Method `css(name, value)` - sets the css property `name` to `value` for the column header as well as for the column cells.
253+
* Method `moveBefore(column)` - moves the column in front of the column refrenced by the parameter. If the parameter is null the column will become the rightmost column.
254+
255+
203256
###Examples
204257

205258
Examples ([look here for sources](https://github.com/angular-ui/ui-scroll/tree/master/demo/examples)) consist of several pages (.html files) showing various ways to use the ui-scroll directive. Each page relays on its own datasource service (called `datasource`) defined in the javascript file with the same name and .js extension.

0 commit comments

Comments
 (0)