Comments (2)
Filtering should be always implemented by developer. It may be implemented whether on client or server side. On client side we put filtering logic into controller method loadData
. On the server side (more common) we pass filter parameters to the server script and apply filtering on server side to avoid transferring of unnecessary data to the client. Thus there is no difference between loading by page and direct loading in case of filtering.
Sorting is really differ for direct loading and loading by page. Direct loading sorts data of the grid. Loading by page strategy just reloads data providing paging parameters to the filter
argument of controller loadData
method (pageIndex
current page index and pageSize
- current page size from grid config). Why it happens this way: loading by page makes sense only when you implement all filtering and sorting logic on the server side, when you have big amount of data. Just imagine you've loaded only first page, does it really make sense to sort only this first page items? Sorting of all data can be implemented only on the server side, because grid just don't have other data.
Possible solution
Anyway, if you wish sorting of data on the current page, it's doable.
All the difference in behavior between loading by page and direct loading is extracted to loadingStrategies (didn't have time yet to describe this advanced info in docs).
jsGrid.loadStrategies = {
DirectLoadingStrategy: DirectLoadingStrategy,
PageLoadingStrategy: PageLoadingStrategy
};
The direct loading strategy does following on sorting:
sort: function() {
this._grid._sortData();
this._grid.refresh();
return $.Deferred().resolve().promise();
}
The loading by page strategy has another implementation:
sort: function() {
return this._grid.loadData();
}
All you need to do is to redefine loading by page strategy behavior (of course, it's possible to create your own loading strategy but it's more complicated than just override sort
method):
jsGrid.loadStrategies.PageLoadingStrategy.prototype.sort = function() {
this._grid._sortData();
this._grid.refresh();
return $.Deferred().resolve().promise();
}
See following fiddle to see how it works http://jsfiddle.net/tabalinas/z39qvxoc/
from jsgrid.
thanks for solution :)
from jsgrid.
Related Issues (20)
- Js grid get cell value cellClick HOT 2
- Need help datetime-local HOT 1
- Is there an official fork that is being heavily used and actively maintained? HOT 1
- Jsgrid select with search box HOT 1
- Detect value of selected value when inserting a new item
- 数据操作时,有没有直接失去焦点保存数据?
- JS grid load data above 5000
- editTemplate on row change error throw $inputFrom was not an function HOT 1
- Multiselect issue.
- Help with a php & Mysql
- Help needed with JsGrid loadData function after I upgraded an old project to .net 7.0 HOT 1
- Help needed with JsGrid loadData function after I upgraded an old project to .net 7.0
- Using autocomplete component with Select2
- How do I validate a DatePicker field? HOT 1
- Loading by Page + Ajax
- how to add password input type in jsgrid HOT 1
- Select type validate required not working in jsgrid
- How to render 1 table instead of 2 tables - First Table(Header, Filter and Insert Row) and Second Table(Item Row) HOT 1
- Load info after save and select option HOT 3
- Manipulating data in a custom field before a row is deleted
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsgrid.