You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+53
Original file line number
Diff line number
Diff line change
@@ -200,6 +200,59 @@ marked with uiScrollViewport directive, the browser window object will be used a
200
200
</ANY>
201
201
```
202
202
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
+
<TABLEui-scroll-viewportclass="grid">
215
+
<THEADstyle="display:block">
216
+
<TR>
217
+
<THui-scroll-thclass="col1">header 1...</TH>
218
+
<THui-scroll-thclass="col2">header 2...</TH>
219
+
...
220
+
</TR>
221
+
</THEAD>
222
+
<TBODYui-scroll="item in datasource"adapter="adapter">
223
+
<TR>
224
+
<TDui-scroll-tdclass="col1">...</TD>
225
+
<TDui-scroll-tdclass="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
+
203
256
###Examples
204
257
205
258
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