Loading data thru function (including server-side pagination/sort/filter)
See original GitHub issueIs there a way to use a function to load data instead of URL? This will be useful, if we are loading data thru other methodologies like websocket etc.
I have done the same by using an attribute source with following code changes. If required, can generate a PR. It worked for my use case as I used deferred to fetch the data in that called function.
In initServer
function changed
if (!(url || this.options.url ) && !this.options.ajax) {
return;
}
as
if (!(url || this.options.url || this.options.source) && !this.options.ajax) {
return;
}
Then added following block in same function before var request=....
if(this.options.source){
let _res=this.options.source(data);
var res = Utils.calculateObjectValue(_this10.options, _this10.options.responseHandler, [_res, undefined], _res);
_this10.load(res);
_this10.trigger('load-success', res, true, undefined);
if (!silent) {
_this10.hideLoading();
}
if (_this10.options.sidePagination === 'server' && res[_this10.options.totalField] > 0 && !res[_this10.options.dataField].length) {
_this10.updatePagination();
}
return data;
}
I am able to get data from the function defined as source:name-of-function
Is there any other better option?
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Server Side Pagination, Filtering, Search & Sorting with ag ...
In this video we go over:- How to implement server side functionality in ag grid with react- How to implement pagination, filter and...
Read more >Add sorting, filtering, and paging - ASP.NET MVC with EF Core
In this tutorial you'll add sorting, filtering, and paging ... The column headings are links that the user can click to sort by...
Read more >A server side external sorting and filtering example #2033
I myself was struggling with implementing a server-side sorting (data were a query to postgres) and came up with a solution that works...
Read more >Front End Tables: Sorting, Filtering, and Pagination
I'm going to set up some data that includes a string, a number, a Boolean, and a date in the dataset, and enough...
Read more >Introduction to Client Side and Server Side Pagination in ...
Pagination is a common Web UI technique that divides large data sets into multiple pages and displays one page at a time.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok. Solved it thru
ajax:function(params) {ajaxhandler(additionalInfo,params); }
Hi… Thanks. It solved original issue. I was having another request to send additional parameters to the AJAX function. This will be useful, if we have multiple tables in the same page and we wanted to have a common AJAX handler. Is there any option available to pass custom additional info to ajax handler in addition to params.