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

SetTotalRecords Property?

12 Answers 374 Views
DataPager
This is a migrated thread and some comments may be shown as answers.
CarlosLima
Top achievements
Rank 1
CarlosLima asked on 29 Jun 2010, 06:19 PM
Hi,

Is there any property that allow us to set the TotalRecords of DataPager ItemSource?

Regards

12 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 30 Jun 2010, 08:46 AM
Hello David Petronzio,

Why would you need to set this? This should only be read. The total number of records is equal to the total number of records. That's it. You cannot and most importantly you should not be able to set it directly. For example if you have a collection of 10 records you cannot simply go an tell it that is has 20 records. I hope this makes sense.

In case you want to "lie" to RadDataPager and tell it what the number of records is you should know that it works with the IPagedCollectionView interface. It is this interface that informs it about things like page size, page index, total item count, etc. So you can control everything by implementing this interface. If you implement this interface, you will be able to "trick" RadDataPager to believe anything, like what the total number of records is. It believes only in this interface.

Please, take a look at my blog post. I explains everything.

Let me know if you have any other questions once you have covered it.

Kind regards,
Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Rossen Hristov
Telerik team
answered on 23 Jul 2010, 09:54 AM
Hi David Petronzio,

A quick follow up. We have decided to log your feature request and call it "Unbound Mode".

When the pager is in Unbound Mode, i.e. it has no Source defined, you will be able to manually specify the total item count so that the pager can calculate its number of pages. The pager will be fully functional with the only difference that it has no source collection to page. This will allow the developer to use the exiting UI without any efforts. The developer can attach to the PageIndexChanging and PageIndexChanged events of RadDataPager and perfom any kind of action depending on the requirements.

How does this sound? Will this meet your requirements?

You can vote for this new feature request here. The PITS ID is 2812.

Regards,
Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
willson
Top achievements
Rank 1
answered on 29 Jul 2010, 12:09 AM
Hi
  I have the same request. Now I use the mode of PagingEndless. But I don't 
want it endless I want it can be stopped at a particular page which I set by code. Is there a way to achieve this functionality

THanks
0
Rossen Hristov
Telerik team
answered on 29 Jul 2010, 07:24 AM
Hello willson,

Could you please elaborate. What do you mean by stopped at a particular page?

Best wishes,
Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
willson
Top achievements
Rank 1
answered on 30 Jul 2010, 05:55 PM
Hi telerik

        I want to use the pagingEndless style but I also want to set the maximum number of pages . When the datapager is at the max page (for example at page 10) the next page button should be disabled.

Thanks
0
Rossen Hristov
Telerik team
answered on 02 Aug 2010, 12:50 PM
Hi willson,

I am completely confused now.

How can something that has a maximum number of pages (end) be endless? Being endless means that you can always click the next page button and get new data. You never know the maximum number of pages because, well, they are endless.

If you know and define the maximum number of pages then when the last page is reached you will be no longer able to go to the next page. This is the opposite of being endless.

I hope this makes sense. Something is endless when it does not have an end and you want your endless thing to have and end. I am sorry but I really cannot understand what your goal is.

You can try to explain it again if you want.

Regards,
Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
willson
Top achievements
Rank 1
answered on 03 Aug 2010, 05:44 PM
Hi Telerik
          It is what I want to achieve.
         1. I want to partial  load the data. I load data from the web service so I can't load large data at one time.
         2. I know the total recordes of the data. So I need to set the  maximum number of pages.
 
        I found only the endless type can load data partially. What should I do if I want to achieve the two points?
Thanks
0
Rossen Hristov
Telerik team
answered on 04 Aug 2010, 07:18 AM
Hello willson,

As I have already stated in this thread, we are currently working on the "Unbound Mode" of the pager. Here it is again:

When the pager is in Unbound Mode, i.e. it has no Source defined, you will be able to manually specify the total item count so that the pager can calculate its number of pages. The pager will be fully functional with the only difference that it has no source collection to page. This will allow the developer to use the exiting UI without any efforts. The developer can attach to the PageIndexChanging and PageIndexChanged events of RadDataPager and perfom any kind of action depending on the requirements.

So, you will set the total amount of records (once the feature is ready). Then each time a PageIndexChanged event occurs -- you will pull only this page from your web service.

To avoid any further confusion: There is no endless type or mode or whatsoever. This is just an online example. The example demonstrates a possible implementation of IPagedCollectionView. This is is not a feature of the pager. It is just a dummy example. And if you take a closer look at the example -- there absolutely no data. Everything is fake. So long story short -- there is not such thing as endless mode. The pager can either have a real Source or be Unbound (once the feature is ready). When it is Unbound -- you tell it how many pages to display in the UI and then you handle its events and do whatever you like in the event handlers.

I hope this makes sense.

Sincerely yours,
Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
willson
Top achievements
Rank 1
answered on 17 Aug 2010, 12:03 AM
Hi Telerik
     I see the Unbound Mode for data pager has been released. But I can't found  guide or lab for this function.
    Can you show me some link to demo this function?
Thanks 
0
Rossen Hristov
Telerik team
answered on 17 Aug 2010, 08:02 AM
Hello willson,

There is nothing special about the Unbound Mode. You simply leave the Pager without specifying any Source, then you are able to manually set the number of items through the ItemCount property. You can do this only when there is no Source. After that you attach to the PageIndexChanged event and do any kind of custom logic.

We have developed this feature because many of our customers wanted to use the only the UI that RadDataPager provides. They did not want to implement the IPagedCollectionView interface in order to feed it as the Source of the pager. So what we did was -- we allow the developer to manually set the ItemCount if and only if the Source property of the pager is left unassigned. That's all -- it's nothing special.

Let us know if you have any other questions. We would be glad to help.

Greetings,
Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
willson
Top achievements
Rank 1
answered on 17 Aug 2010, 11:00 PM
Hi Telerik
        I set the ItemCount property as you say. But it shows an error .
        Error 1 Property or indexer 'Telerik.Windows.Controls.RadDataPager.ItemCount' cannot be assigned to -- it is read only D:\silverlight\BusinessApplication7\BusinessApplication7\Views\Home.xaml.cs 17 13 BusinessApplication7
        I have installed the older version and updated to this new. need I reinstalled the controls again? 
Thanks
0
Rossen Hristov
Telerik team
answered on 18 Aug 2010, 08:04 AM
Hi willson,

What version are you using? You need to upgrade to the latest one, where we introduce this feature.

All the best,
Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
DataPager
Asked by
CarlosLima
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
willson
Top achievements
Rank 1
Share this question
or