apGrid
A jQuery plugin to manage data vision in a table or dataGrid.
Features
- sticky header and footer
- easy themeable
- print support
- dynamic data
- sorting
progressive loadingTODOvirtual scrollingTODOfilteringTODO
Documentation
setup
Call apGrid from a div:
jQuety.apGrid(settings);
settings
Type: PlainObject
A set of key/value that configure the apGrid-
-
height
The height of the table in video, on print the table is unlimited. default: ayti
-
columns
Type: Array of PlainObject
An array that defines the comuns of the table
-
name
Type: String
Internal name of the column it is used to identify the column internally
-
text
Type: String
the header text, if not defined colX (with X number of colume) is used.
-
percent
Type: Number
The width of the colum, in percent of the table-
TODO Support for specific width.
-
format
The function to use to translate the data in string to be shown on screen
-
sortable
Type: Boolean
If true the header will be clickable and every click sort the data based on this column.
It is possible in case of dynamic data
-
-
data
Type: Array or PlainObject or
Promise of (Array or PlainObject) or Function(PlainObject)the source of the data to show, it can be static or dynamc, the dynamic source is the function.
- Array: in case of array data they will be shows in rows, they are expected like:
[[dataRow1Col1,dataRow1Col2, ... ,dataRow1ColX],[dataRow2Col1,dataRow2Col2, ... ,dataRow2ColX], ... ,[dataRowYCol1,dataRowYCol2, ... ,dataRowYColX]]
- PlainObject: specifing an object is possible define only a part of data to show.
- Promise of one of above types: will be shown an loading overlap waiting the promise result. TODO
- Function that returns one of above types: if will be called if an indefinite rows are on screen. it will be called with these parameters.
- Array: in case of array data they will be shows in rows, they are expected like:
-
pageSizeType: Number
In case of dynamic data, it specified how many rows ask to function specified on data. default: 20 TODO
-
indefiniteSizeType: Number
Number of indefinite rows visible before the function call. the default is 10% of pageSize TODO
-
footer
Type: String or Function(PlainObject) html code to write on footer. or a function to be call every time the data is updated.
Methods
setData
Allows to update the data on the grid.
$(grid).apGrid("setData", [data], [highlight])
- data same as data setting.
-
Boolean or Number highlight if true every changed It will add the class changed to every cell where the text changes. if boolean for one second, the specified value in msec otherwise.
It can be specified on data if it is a PlainObject.
If data is not specifed last data function is called.
addFooter
Allows to set the footer of the grid
$(grid).apGrid("addFooter", footer)
- footer as footer setting.