This is a migrated thread and some comments may be shown as answers.

grid.pageSize Undefined = All, but not wise versa setting through datasource

12 Answers 21 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Aleksandr
Top achievements
Rank 1
Iron
Veteran
Aleksandr asked on 11 Feb 2021, 09:42 PM

we started using an option to show all records in the grid by giving the user choose from predefined values [10, 25, 50, All], to set all to datasource we need to set it to undefined

grid.dataSource.pageSize(undefined);

 

but it will be ignored & page size will not be changed 

please provide workaround

 

 

 

12 Answers, 1 is accepted

Sort by
0
Aleksandr
Top achievements
Rank 1
Iron
Veteran
answered on 15 Feb 2021, 05:45 AM

dojo 

 

https://dojo.telerik.com/asoPIkan/5

0
Eyup
Telerik team
answered on 15 Feb 2021, 10:23 PM

Hello Aleksandr,

 

Thank you for writing to us and sending the dojo sample. The solution consists of 2 parts:

1. Removing the $top=20 from here to get all the data:

2. Calling undefined here:

grid.dataSource.pageSize(undefined);
3. (Optional) Since there are 800+ records in total, I've move the pager to top for convenience:
 position: "top"
You can find the full updated version of the sample in this URL:
https://dojo.telerik.com/asoPIkan/18

It works as expected on my side. Feel free to try it out and let me know how it goes from your end.

 

Regards,
Eyup
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Aleksandr
Top achievements
Rank 1
Iron
Veteran
answered on 16 Feb 2021, 06:28 AM

Hello Eyup,

appreciate for helping me, still have one issue, it is related than we use approach of selection the items across the pages, please see attached 1 jpg

 

Thx Alex

 

 

 

 

 

 

 

 

0
Aleksandr
Top achievements
Rank 1
Iron
Veteran
answered on 16 Feb 2021, 06:32 AM

& the question about grid.dataSource.pageSize(undefined);

we store grid page size value in localstorage to have same across all the modules, so if i store All (undefined), i need to load it to set to the grid, but it will be ignored, how i can set All programmatically?

0
Aleksandr
Top achievements
Rank 1
Iron
Veteran
answered on 16 Feb 2021, 07:05 AM
the issue with setting pagesize undefined (all) please see on screen 2
0
Aleksandr
Top achievements
Rank 1
Iron
Veteran
answered on 16 Feb 2021, 07:08 AM

dojo 

 

https://dojo.telerik.com/asoPIkan/21

0
Eyup
Telerik team
answered on 17 Feb 2021, 11:01 AM

Hi Aleksandr,

 

You can achieve this requirement using the following approach:

      var grid =  $("#grid").data().kendoGrid;
      grid.one("dataBound",function(e){
        grid.dataSource.pageSize(grid.dataSource.data().length);
      });
Here is the full working sample:
https://dojo.telerik.com/asoPIkan/34

Feel to give it a try and let me know if it helps you.

 

Regards,
Eyup
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Aleksandr
Top achievements
Rank 1
Iron
Veteran
answered on 17 Feb 2021, 08:14 PM

Eyup,

 

the approach is not ideal, but acceptable, appreciate for help

P.S if the team can make our live easier adding features we use to the grid, to have them out of the box, i would appreciate 

 

 

 

0
Aleksandr
Top achievements
Rank 1
Iron
Veteran
answered on 18 Feb 2021, 10:03 AM

fixed workaround (the workaround above always set pager to all)

 

grid.one("dataBound", function (e) {
           if (grid.dataSource.pageSize() === undefined) {
               grid.dataSource.pageSize(grid.dataSource.data().length);
           }
       });
0
Aleksandr
Top achievements
Rank 1
Iron
Veteran
answered on 18 Feb 2021, 11:12 AM
update: the solution does not work when add item from one grid to another(update database & reread the main grid), newly added record does not show up due to setting main grid pager to length
0
Eyup
Telerik team
answered on 19 Feb 2021, 09:51 AM

Hello Aleksandr,

 

Can you send us the new dojo URL so we can resolve the problem accordingly and send it back to you?

 

Regards,
Eyup
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Aleksandr
Top achievements
Rank 1
Iron
Veteran
answered on 19 Feb 2021, 02:34 PM

Eyup,

taking into consideration the risk of unexpected behavior in diff cases we decided to not to deliver "All" option & set it to 20 000 (it is less user friendly, but better than bugs), it will cover "full grid" for majority of our client, hope, in future the grid will fully support "All" in all cases 

Thx Alex

Thx Alex

 

 

Tags
Grid
Asked by
Aleksandr
Top achievements
Rank 1
Iron
Veteran
Answers by
Aleksandr
Top achievements
Rank 1
Iron
Veteran
Eyup
Telerik team
Share this question
or