Custom pager info

1 Answer 43 Views
Grid Pager 
Ewald
Top achievements
Rank 1
Iron
Ewald asked on 13 Oct 2023, 01:37 AM

I want to customize the Pager, but from what I can see I will have to build the whole pager. I only wan to update the Pager info from "1 - 50 of 55 items" to just "55 items".

Is that posslbe?

1 Answer, 1 is accepted

Sort by
1
Accepted
Vessy
Telerik team
answered on 16 Oct 2023, 02:41 PM | edited on 16 Oct 2023, 02:41 PM

Hi, Ewald,

You can replace the pager info string with the desired one by localizing its default `pager.info` message:

For convenience, I have created a sample demonstrating this approach here:

Please, give it a try and let me know in case I can assist you any further on this matter.

Regards,
Vessy
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources!

Ewald
Top achievements
Rank 1
Iron
commented on 20 Oct 2023, 10:52 PM | edited

I got it to work, but it was not easy. The documentation is not great for localization.

The steps that I took were:

1. Install the NPM package @progress/kendo-react-intl

2. Add a json file in the same directory for each language that I want to support. 

The json that I used looks like

{
	"grid": {
		"pagerInfo": "{2} items"
	}
}

 

3. Add the following lines of code to my tsx file

import { LocalizationProvider, loadMessages } from'@progress/kendo-react-intl'; import enCustomMessages from'./locales/en.json';

loadMessages(enCustomMessages, 'en');

 

4. Surround the KendoGrid component with the LocalizationProvider component. Since I use i18next with browser language detection, I used their resolvedLanguage.

<LocalizationProvider language={i18n.resolvedLanguage || 'en'}>
<KendoGrid


Vessy
Telerik team
commented on 24 Oct 2023, 09:07 AM

Thanks a lot for sharing the taken steps, Ewald!

The detailed information regarding the Globalization feature of all components can be found here (use the tree on the left to navigate through the nested sections):

It is linked in the previously provided article but we will think of a way to making it more obvious and easier to be found.

Regards,
Vessy

Ewald
Top achievements
Rank 1
Iron
commented on 24 Oct 2023, 03:01 PM

I have been browsing those pages, but the information available there is very limited and not very helpful
Vessy
Telerik team
commented on 26 Oct 2023, 11:09 AM

I see. Thanks again for the shared feedback, Ewald, we will think of a possible way to improve the section.
Tags
Grid Pager 
Asked by
Ewald
Top achievements
Rank 1
Iron
Answers by
Vessy
Telerik team
Share this question
or