mike-allison / kodatatable Goto Github PK
View Code? Open in Web Editor NEWa dynamic datatable viewmodel/template for Knockout with search, header sorting and item selection.
a dynamic datatable viewmodel/template for Knockout with search, header sorting and item selection.
Really liked your interface. So used your code in a project and implemented a column reordering functionality with the help of an existing column reordering tool. here. thanks
Congrats this work, it's pretty cool.
When implementing this plugin I've came across with an odd behaviour while switching pages - although I was unable to reproduce it on the examples page.
Here's my case (using Chrome Version 43.0.2357.65 m - developer tools on):
Solved it by changing from
this.currentRows = ko.computed((function(_this) {
return function() {
if ((_this.currentPage() + 1) * _this.pageSize() > _this.filteredRows().length) {
return _this.filteredRows().slice(_this.currentPage() * _this.pageSize());
} else {
return _this.filteredRows().slice(_this.currentPage() * _this.pageSize(),
+((_this.currentPage() + 1 * _this.pageSize()) - 1) + 1 || 9e9);
}
};
to
this.currentRows = ko.computed((function(_this) {
return function() {
if ((_this.currentPage() + 1) * _this.pageSize() > _this.filteredRows().length) {
return _this.filteredRows().slice(_this.currentPage() * _this.pageSize());
} else {
return _this.filteredRows().slice(_this.currentPage() * _this.pageSize(),
+(((_this.currentPage() + 1) * _this.pageSize()) - 1) + 1 || 9e9);
}
};
Case it's not clear, wrapped the _this.currentPage() + 1 with an extra () in the else block... You have it in the if statement.
Like I wrote, in your example page it works fine.
I'm using bower in this implementation.
Hope it helps.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.