Reputation: 109
I'm working on a Kendo Grid (jQuery) and have been trying to set the page size to the value of a variable which is acquired from the users preferences settings.
dataSource: {
pageSize: userPageSize
}
Setting the page size like this doesn't work and displays the first 20 rows on the first page, but then displays all the remaining results (78 rows) on page 2 and 3 with the last 20 on page 4.
But when I use:
dataSource: {
pageSize: parseInt(userPageSize)
}
The paging works correctly! I only tried it on a whim when experimenting and can't find any explanation as to why it only works when parsing it, I'd really like to know why.
Upvotes: 0
Views: 1132
Reputation: 3882
pageSize
expects a number as an argument. You get the same strange behavior if you set the pageSize
to a string right from the start in the options object.
The userPageSize
value you get from the user is a string and should be parsed as an integer.
You can also see a discussion about this in the Telerik forums here.
Also, the dataSource.pageSize
method reference from Telerik's documentation here.
Upvotes: 2