Skip to content

rogercoder/Knockout.simpleSortableGrid

 
 

Repository files navigation

Knockout Simple Sortable Gird

Knockout Simple Sortable Gird is enhanced version of Knockout Simple Grid found at [http://knockoutjs.com/examples/resources/knockout.simpleGrid.3.0.js] In addition to the existing features this supports Sorting and it also uses Font Awesome icons which is optional user can provide their own class for sort icon. Also sorting can be enabled and disabled by simply changing attribute/property values

Sample

var PagedGridModel = function (items) {
    this.items = ko.observableArray(items);
    this.gridViewModel = new ko.simpleSortableGrid.viewModel({
        data: this.items,
        columns: [
            { headerText: "Item Name", rowText: "name", isSortable: true },
            { headerText: "Sales Count", rowText: "sales", isSortable: true },
            { headerText: "Price", rowText: 'price', isSortable: true }
        ],
        pageSize: 5,
        cssTableClass: 'table table-striped table-hover',
        sortByClass: 'yourClassName',
        sortByClassAsc: 'yourClassNameAsc',
        sortByClassDesc: 'yourClassNameDesc',
    });
};

Change the property isSortable to true to enable sorting.

Setting pageSize to 0 disables pagination.

Also if user want to change the default sort icon to be change. Update the sortByClass, sortByClassAsc and sortByClassDesc property values

About

This is an enhanced version of http://knockoutjs.com/examples/resources/knockout.simpleGrid.3.0.js which contains basic Grid with Pagination but this one has Sorting feature in it.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 81.0%
  • HTML 19.0%