Knockout DataTable is a flexible and reusable Knockout.js view model for data tables.
Check out the demo to get a quick idea of how it works and how to use it.
To install it in your bower-enabled project, run bower install knockout-datatable
.
Or drop the knockout-datatable{.min}.js
file in your vendor assets javascript folder and require it in your application.
Refer to the demo for detailed usage instructions.
The following methods are available on the DataTable instance:
prevPage()
- go to the previous page (if not on page 1)nextPage()
- go to next page (if not on last page)toggleSort(field)
field
field
field
if not already sorted by field
gotoPage(pageNum)
- sets the current page to pageNum
pageClass(pageNum)
- returns "active"
if pageNum
is the current pageaddRecord(new_record)
- pushes new_record
onto the datatable's rowsremoveRecord(record)
- removes record
from the datatable's rowsreplaceRows(new_rows_array)
new_rows_array
1
forceFilter(true|false)
- enable / disable forcing filtering of the roles
To build the Knockout DataTable coffeescript source, do the following in a node.js enabled environment:
npm install -g grunt-cli
npm install
grunt
To run the tests, do the following in a node.js enabled environment:
npm install -g grunt-cli
npm install
grunt test
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)See Contributors
Knockout DataTable is released under the MIT License. Please see the LICENSE file for details.