Hello,
I'm using TreeGrid version 24.2.4. I'm able to display data in my tree grid from external data source by providing an object like this:
{
result: [...], //15 records here
count: 256
}
My pageSize is 15 so I expect to see 256/15 pages in my paging but I see only one. I tried to create a
PageSettingsModel object with the correct values but it doesn't work for me. Could you please give an example with the correct way of setting the data source of the tree grid? The only way I found is to provide all the data in advance which is not an option for me.
Best Regards,
Dimitar
Hi Dimitar,
Before we start proceeding with your query, we request you to share with us the details below to provide you with the solution as early as possible.
Kindly get back to us for further assistance.
Regards,
Pon selva
Hello Pon selva,
{
result: [...], //15 records here
count: 256
}
as described in your documentation.
Hi Dimitar,
Thanks for the details provided. We can achieve this query by using the pageSizeMode property as ‘All’ where the parent and children are considered while rendering records for a page. By doing so, the records as per the pageSize will be rendered in exact.
Sample : https://stackblitz.com/edit/vq813j-kdwwqb?file=src%2FApp.vue
Documentation: Paging in Vue Treegrid component | Syncfusion
Upon checking up with the details provided, we need some more clarifications regarding your query. Kindly share any of the following details,
We are happy to assist you further.
Regards,
Vasu P.
Hello Vasu,
Thank you for your suggestion, but setting pageSizeMode property to All will not fix my problem. I don't need the child records to be considered while rendering and creating the pager.
About the additional information you required:
1. I don't use any adaptor. My data comes from a web service and I send skip and take parameters to get the data from a specific page.
2. On initial load the total number of data count will be 15, not the complete datasource. If I provide on initial load the complete datasource the pager works as expected.
3. Yes, 15 records initially and the pager should show links for the other pages.
4. Not possible, sorry.
Greetings,
Dimitar
Hi Dimitar Karamfilov,
Thank you for the details shared.
Based on your shared details, this requirement can be achievable through Url Adaptor of DataManager. For data processing in remote data where we can render the data based on the page size with result and count as the total number of records. Kindly refer to the below code snippet,
|
App.vue~
const Remotedatasource = new DataManager({ url: 'https://localhost:7297/Home/Datasource', adaptor: new UrlAdaptor, updateUrl: https://localhost:7297/Home/Update, insertUrl: https://localhost:7297/Home/Insert, removeUrl: https://localhost:7297/Home/Delete, crossDomain: true, offline: false });
Controller.cs~
public IActionResult DataSource([FromBody] DataManagerRequest value) { if (TreeData.tree.Count == 0) TreeData.GetTree(); IEnumerable DataSource = TreeData.tree;
DataOperations operation = new DataOperations(); ...
return value.RequiresCounts ? Json(new { result = DataSource, count = count // include the dataSource count(256)}) : Json(DataSource); }
|
The modifications have been done to the sample and attached. Kindly use it for you reference.
Documentation link:- https://ej2.syncfusion.com/vue/documentation/treegrid/editing/persisting-data-in-server#url-adaptor
Steps To Connect Backend and rendering code:
We are happy to assist you further.
Regards,
Vasu P.
Thank you!
Dimitar,
Please feel free to contact us if you need any further assistance.