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

Change the QueryName of a RadDataServiceDataSource?

7 Answers 58 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Wayne
Top achievements
Rank 1
Wayne asked on 15 Jun 2012, 06:28 PM
It seems that I can supply a {Binding} for the QueryName of a RadDataServiceDataSource, but if I do, it changes the way the data source gets queried. Using the "hard-coded" approach, the query honors the page size specified by the data source ($top=n), but binding to a property of a ViewModel that contains the QueryName causes the query to request ALL items.

What I'm trying to craft is a simple UI that lists the tables (queries) in the data source in a ListBox, and causes the RadGridView/RadGridPager to display (and page through) the data for the table selected in the ListBox.

I had assumed that data binding the QueryName would be the WPF way to do this. What am I missing?

7 Answers, 1 is accepted

Sort by
0
Wayne
Top achievements
Rank 1
answered on 15 Jun 2012, 07:37 PM
Also, when changing the QueryName back to that of a query previously selected (and having loaded all items), the app takes a _VERY_ long time at 100% CPU to repopulate the grid (several minutes), even though the original query/populate only took a few seconds.

I'm starting to think that changing the QueryName is not supported... can anyone confirm?
0
Nedyalko Nikolov
Telerik team
answered on 20 Jun 2012, 07:16 AM
Hi,

I'm attaching my sample application that covers your scenario. Could you please take a look at let me know what to do in order to simulate delay issue?
Thank you in advance.

P.S. You will need a running SQLEXPRESS with Northwind sample database installed (otherwise you could change the connection string within web.config).

All the best,
Nedyalko Nikolov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Wayne
Top achievements
Rank 1
answered on 20 Jun 2012, 02:21 PM
Nedyalko,

Thanks, your sample causes the correct paged queries to be used. I was starting with the sample from here: 

http://www.telerik.com/community/forums/wpf/gridview/hang-crash-with-odata-service.aspx 

which has the PageSize set on the RadDataServiceDataSource, and not on the RadDataPager. Sure enough, if I change your sample to do the same, it exhibits the broken behavior.

The delay occurs, I think, as a result of trying to render every row in the table. The Northwind database is not a good test in this case since the database is relatively small (I think the largest table is Orders with about 800 rows). Even with the Northwind database, however, I see a noticable increase in the time taken to render (not retrieve) every Order on the second and subsequent queries.

My actual database has substantially more rows (which is precisely why I want to page through it), and without paging the client is taking several minutes to render after the second and subsequent queries to the same table.
0
Nedyalko Nikolov
Telerik team
answered on 21 Jun 2012, 07:34 AM
Hi,

Indeed paging will help with rendering delays, but first of all could you please check if RadGridView is placed in a StackPanel or any other panel which measures the grid with Double.PositiveInfinity. For more info you can take a look at this online help topic.

However we will investigate paging issue and most probably we'll fix it in a couple of weeks (every Monday we have an internal build, so stay tuned).

Regards,
Nedyalko Nikolov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Wayne
Top achievements
Rank 1
answered on 21 Jun 2012, 01:09 PM
The RadGridView is in a <Grid> row with Height="*".
But, since I'm setting RadDataPager.PageSize=N, won't that limit the maximum height of the RadGridView to just that height which is enough to show N rows?
0
Nedyalko Nikolov
Telerik team
answered on 22 Jun 2012, 08:04 AM
Hi,

Placing RadGridView in a grid panel with row height "*" is OK and indeed RadGridView will generate only several rows (to fulfill the available space), but grid will not be shrinked (if there are not enough items there will be an empty space inside RadGridView).

Kind regards,
Nedyalko Nikolov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Rossen Hristov
Telerik team
answered on 26 Jun 2012, 09:17 AM
Hello,

Can you please try using the underlying collection QueryableDataServiceCollectionView<T> and expose it on your view model. Then each time the user changes the query -- create a new instance of this collection and raise property changed. Bot the grid and the pager should be bound to this collection on the view model.

Kind regards,
Ross
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Wayne
Top achievements
Rank 1
Answers by
Wayne
Top achievements
Rank 1
Nedyalko Nikolov
Telerik team
Rossen Hristov
Telerik team
Share this question
or