angular-mesa ====================
npm install angular-mesaangular-mesa
====================
A table component built in angular. Handles large datasets by virtualizing rows. Live demo
Feature List
------------
- column-specific filtering
- column sorting
- stacked ordering
- column resizing
- column re-ordering
- localStorage state persistance
- pagination
- server-side interaction support
Installation
------------
``bash`
$ git clone git@github.com:DataTorrent/angular-mesa.git
$ cd angular-mesa
$ npm install .
$ bower install
Getting Started
---------------
- Include ap-mesa.js and ap-mesa.css in your project.
- Add the apMesa module to your project's angular dependencies.
- Instantiate table instances with a tag:
`HTML`
columns="columns"
rows="rows"
table-class="table"
selected="array_of_selected">
Running the Demo
----------------
Clone the repository and run the following:
`bash`
$ npm install
$ bower install
$ grunt serve
Attributes
----------
The ap-mesa tag can have the following attributes:
| attribute | type | required | description |
| ----------- | ------ | -------- | --------------------------------------------------------------------------------------------------------------------------- |
| options | object | no | An object containing various options for the table. See Options Object below for details |
| columns | Array | yes | An array of column definition objects. See Column Definitions below. |
| rows | Array | yes | An array of data to be displayed. See the note on maintaining $$hashKeys in order to allow for more performant data updates |
| table-class | String | no | A string of classes to be attached to the actual
. By default, each column | will have the value of the id field. If the label option is specified, apMesa will use that instead.labelTemplate or labelTemplateUrl is specified, it will replace the default text with the provided template.column and the options object as options.sort attribute of a Column Definition Object to a function with the following signature:Array.prototype.sort works: If the returned value is negative, rowA will be placed above rowB in the ascending sort order. If it is negative, rowB will be placed above rowA in the ascending sort order. If it is zero, the two rows will be considered the same in terms of sorting precedence."string", "number", "stringFormatted", and "numberFormatted". To use these, simply set the sort attribute to one of these strings.initialSorts option in the Options Object, shown in the table above.filter function is set on a Column Definition Object, that column will contain an input field below the main column header where the user can type in a value and the rows will be filtered based on what they type and the behavior of the function. This function should have the following signature:value if there is no format function for the column.placeholder attribute directly to the filter function. To add a title/tooltip, add a title attribute, e.g.:`js`row[key] by specifying a format function on the column definition object. For example, perhaps you want to add a dollar sign to a column which represents an amount of money:`javascript`selected array that is provided through an attribute of the ap-mesa element. The following is an example column definition for a selector (Usually this column appears first):expandableTemplate or expandableTemplateUrl and call toggleRowExpand() from a custom column template. For example, a column definition may look like:`javascript`rowIsExpanded which is a boolean indicating if the row's panel is expanded.rowPadding option at least as large as the expected pixel height of the expanded panels./app/scripts/controllers/expandable.js.refreshExpandedHeight which should'PAGINATE', 'SCROLL', or 'NONE'.tableHeight, fillHeight, and fixedHeight options.tbody. The tableHeight, fillHeight, and fixedHeight options will NOT be honoredgetData function on your table options object which will enable server-side interaction. It must implement the following function signature (see inline explanation):`javascriptvalue field direction field that will either be 'ASC' or 'DESC'. Note that the order of this`getData is specified, angular-mesa only checks the filter and sort fields in the column definition objects for "truthiness".It does not perform any sort of sorting and filtering itself; that is left up to the server to do.angular-mesa.d.ts` typescript definition file has a more formal signature for this function that may help if you are familiar with TS.
|
|---|