OE 11.5.1. First experience with Telerik RadGridView for Win

Posted by Stefan Marquardt on 02-Sep-2016 02:00

I loaded the Telerik winform demo and placed a GridView on my form and tried a few ways to populate it with data.


1 Query to the database with WHERE condition to limit records
2 Query to a temp-table create from the same WHERE condition
3 Dataset with the same temp-table
4 Unbounded, adding rows in a EACH query

Option 1 was done very fast, binding-source, read schema from table and attach the query handle.
But then I clicked on a col header and expected fast sorting (~1300 records) but no, I can go for a coffee.
VST (protop) shows I high access to the table, much more than the initially load.

Option 2 and 3 are faster because the temp-table is in memory but still too slow.
And the needed time depends on the selected col.
Then I added indexes to the temp-table to every col I like to sort, no change.

Option 4 needs a few seconds to fill the grid but then I can click on any col and the sorting is done at once.


Result:
Bounded fills the grid fast but sorting is not really possible
Unbounded fills slow but sorting is as fast as expected.


Until now I have no idea what happens in the background to get a clue about the logic behind


Who has the same experience and knows perhaps the trick?

All Replies

Posted by Laura Stern on 02-Sep-2016 08:22

Yes, I'm not surprised that it's slow since the control will keep asking for data from the BindingSource to do the sort.  It has to read at least every single row once, but to do the sorting algorithm, it generally accesses many of the the same records over and over.  

In general, the best way is to subscribe to the BindingSource's SortRequest event (I think that's the name - not in the office to look it up).  Then in your event handler you can reconfigure the query by adding in a BY clause on the sort column.  The info to use is available in the event arguments.  Then just reopen the query based on the new sort order.

What I don't know is how this interacts with the Telerik control.  You need to basically turn off the automatic sorting that the control does to do this instead.  And maybe there's a control event that you would use instead of the BindingSource's to know when to do the sorting and what column to use.  

Hope this at least points you in the right direction.

Posted by Stefan Marquardt on 02-Sep-2016 09:06

yes, doing the sorting myself would be a theoretically option. I need to check how to implement this.

But then I have to write the query and perhaps handling grouping too?

My favorite would be to fill the data and then run the sorting within the control, it has every record - no batching.

That's the cause to buy a awesome control to avoid coding myself.

Posted by Stefan Marquardt on 06-Sep-2016 01:29

Laura,

unbounded is fast - very fast - sufficient.

But filling the control by ABL with a for each and add row is slow, too slow.

Idea 1:

- Fill bounded

- Disconnect from the data-source without loosing the existing data

or

How to fill the control unbounded in a faster way than record by record?

This thread is closed