There is a select
component embedded inside Pagination
component for changing pageSize
. I want to customize the options label in this select
box so I can have my numbers in other languages.
This is possible in a standalone Select
component by defining options
like this:
options = {[
{ value: "10", label: <span>10 in another language</span> },
{ value: "20", label: <span>20 in another language</span> },
]}
Though I couldn’t find a way to override these options in Pagination
.
I tried setting locale
property, but it only changes / page
label. I want to change the number itself.
locale: { items_per_page: "label to replace [/ page] label" }
I also tried setting pageSizeOptions
, but the problem is I can only assign arrays of strings or numbers to it. It wouldn’t take objects with label
and value
keys like the Select
component.
And using strings like below causes generating a NaN
for pageSize
:
<Pagination
//This is not possible:
pageSizeOptions={[
{
label: formatNumbers("10", lng) as string,
value: 10,
},
{
label: formatNumbers("20", lng) as string,
value: 20,
}
]}
//This is what it accepts, but will cause error:
pageSizeOptions={[
formatNumbers("10", lng) as string,
formatNumbers("20", lng) as string,
]}
onShowSizeChange={(current, size) => {
console.log(size); // returns NaN
}}
defaultCurrent={1}
total={100}
/>