I've found this example for "Load on Demand - loadTrigger: auto" at: https://www.igniteui.com/grid/load-on-demand.
In the link they bind the static datasource, Is there anyway to bind the custom dynamic datasource before grid auto trigger everytime? Like when I scrolling the grid then call my service to get the dynamic data then igGrid bind my dynamic data to the grid
Thank you.
Hello Kwang,
It's possible to bind igGrid LoadOnDemand to remote data source as long as the data source supports remote paging. For example you can bind it to oData service or you can use Grid MVC helper wrapper.
If you're using your own custom data source then you should parse the igGrid request parameters and process the paging yourself.
Attached you can find a sample which binds igGrid LoadOnDemand to a remote oDate service.
Best regards,Martin PavlovInfragistics, Inc.
Hello,
I am using MVC helpers to configure igGrid.
When I configure LoadOnDemand for Grid in following way, I do not see Type available. I need to set the type to remote.
feature.LoadOnDemand().ChunkSize(10).LoadTrigger(LoadTrigger.Button).Type (OpType.Remote);
PLease help
Thanks,
Rajesh
Thanks Martin,
May I know if LoadOnDemand workes with other feartures line seleciton filtering etc ?
Hi Martin,
Me we know expected date of release of this feature ?
We are really depending on this feature for may pages.
Hello Rajesh,
This feature will probably be RTM in 14.2 release. In 14.1 release it will be CTP again.
The feature should work with no problem when used alone. As I already said there may be problems when the feature is used with other features. You should test whether the feature is working as expected in your specific application scenarios before depending on it in production.
Hope this helps,Martin PavlovInfragistics, Inc.
Hello Martin,
Thanks for the information.
LoadOnDemand is not triggering for me. I tried remote sorting and filtering with this code, that works fine.
Here is my client code
@(Html.Infragistics().Grid(Model.Customers.AsQueryable()) .Width("400px") .Height("300px") .AutoGenerateColumns(false) .Features(feature => { feature.LoadOnDemand().ChunkSize(10).LoadTrigger(LoadTrigger.Button); }) .DataSourceUrl(Url.Action("GetAllC")) .DataBind() .Render() )
Here is controller...........
public ActionResult GetAllC() { var viewModel = new CustomersViewModel { Customers = GetCustomers(),
};
return View(viewModel.Customers.AsQueryable<Customer>());}
Can you please let me know what can be wrong ?
There is a small issue in LoadOnDemand when used in the Grid MVC wrappers. It sends oData parameters instead of the default MVC ones. I logged this and fixed it, so it will be available in the next 13.2 SR.
The workaround again is to directly modify the igDataSource prototype (keep in mind that this is a global change, so it may affect other grids on the page). Here is the code:
$.ig.DataSource.prototype.settings.paging.pageIndexUrlKey = "page";
This code should be executed before the grid is initialized and after infragistics.datasource.js file is loaded. You can of course return the pageIndexUrlKey back to its original value after the grid is created.
hi Martin,
I have created another post for clarity.
http://es.infragistics.com/community/forums/p/88078/437959.aspx#437959
Thanks for your inputs
Rajesh Varade said:Can you please let me know what gird events are fired after igGrid LoadOnDemand is triggered and completed?
The LoadOnDemand events are described here:
http://help.infragistics.com/jQuery/2013.2/ui.iggridloadondemand#events
Rajesh Varade said:I am trying to catch iggridrowsrendered event after load on demand and not able to hit it.
What is the code you're using?
Rajesh Varade said: Can you please throw some light on this? I am struggling to make SelectionPersistense.js work with load on demand. The restoreSelection() function of this .js file is tied with iggridrowrendered.
Can you please throw some light on this?
I am struggling to make SelectionPersistense.js work with load on demand. The restoreSelection() function of this .js file is tied with iggridrowrendered.
I guess that you know that you first need to enable the selection persistence with the code like this:
$(document).on("iggridrendered", "#grid1", function rendered (evt, ui) { sp = SelectionPersistence(ui.owner); sp.enableFiltering(); });
This code needs to be executed before the grid is initialized.
The iggridrowsrendered event will be thrown only when the grid is created or data bound. When user presses the "Load more data" button the igGridLoadOnDemand.rowsRequesting and igGridLoadOnDemand.rowsRequested events are fired sequentially.
From what I see the SelectionPersistence code will work without the need for modifications.
P.S.: About your previous post:
Rajesh Varade said: I am still not able to trigger the LoadOnDemand. But when I execute filter feature for at least once, after that LoadOnDemand works fine. But for the first time it does not work.
I am still not able to trigger the LoadOnDemand.
But when I execute filter feature for at least once, after that LoadOnDemand works fine. But for the first time it does not work.
I was not able to reproduce the behavior you describe. Your code looks Ok except that the autoGenerateColumns = false, but there are no columns defined.
Overall I'm not sure what you're trying to achieve, because your sample code shows one set of features, but then you're talking about a different set of features.
Next time, please open a new thread, because this thread discussion was created for a different scenario from yours.
Can you please let me know what gird events are fired after igGrid LoadOnDemand is triggered and completed?
I am trying to catch iggridrowsrendered event after load on demand and not able to hit it.
Thanks for the quick fix.
I have below code now
<script> $.ig.DataSource.prototype.settings.paging.pageIndexUrlKey = "page"</script> @(Html.Infragistics().Grid(Model.Customers.AsQueryable()) .Width("400px") .Height("300px") .AutoGenerateColumns(false) .ResponseDataKey("Records") .Features(feature => { feature.Filtering().Type(OpType.Remote); feature.LoadOnDemand().ChunkSize(10).LoadTrigger(LoadTrigger.Button); }) .DataSourceUrl(Url.Action("GetAllC")) .DataBind() .Render() )
Can you please let me know how do I make it work without using filter once.
Also the above fix has resolved one more problem for me, now after filtering is used at least once, grid is not filled with whole data. It is filled with only ChunkSize of LoadOnDemand Feature.
Thanks
Rajesh Varade