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

Best practice approach to GridView orientation

2 Answers 64 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 16 Nov 2011, 03:42 AM
Hello,

We have a UI driven requirement for an editable GridView to be presented in a non-default orientation. That is rather then...

Col1 | Col2 | Col3
-----------------------
   A   |   1   |   true
-----------------------
   B   |   2   |  false

It should be more like this...

Col1 |   A   |   B
------------------------
Col2 |   1    |   2
------------------------
Col3 | true  | false

This would also include the use of FrozenColumns (however now, in a sense, acting as frozen rows).

I have seen posts on these forum relating to this kind of requirement. One involving manually pivoting the bound data (which did not really resolve placement of the Headers or the fact that field Type is shared on a per row instead of a per column basis) and one involving using the LayoutTransformControl to rotate the GridView -90 degrees and then rotate each cell template back again. The latter introduced some UI nits (particulalry around scrolling and tab stops).

My questions are...

1) Are we using the right control for this? I don't want to force a control to do something that it isn't meant for. Is there a better option? E.g. Pivot Table? Spreadsheet Control?

2) Does Telerik have a recommended approach for this scenario, given that it has been posed and answered once or twice before?

3) Would it be possible to do this by rewriting one or two of the ControlTemplates involved in the GridView without breaking Themes, Animations, etc. that are being applied to the standard GridView.

Any help is massively appreciated.

Best regards,
Alex


2 Answers, 1 is accepted

Sort by
0
Accepted
Milan
Telerik team
answered on 22 Nov 2011, 02:56 PM
Hi Alex,

  RadGridView has no built-in support for pivoting the data source. Having this in mind I do not recommend changing the default templates to try to simulate pivoting simply because you will end up with a lot of modified and ugly XAML and most probably many features will not work as expected. 

  Another option is to pivot the data itself as demonstrates here. Unfortunately this approach might not be applicable to your scenario. Could you please try it and let me know if it works as expected. 


Kind regards,
Milan
the Telerik team

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

0
Alex
Top achievements
Rank 1
answered on 25 Nov 2011, 02:02 AM
Thanks. We went with the "modify and maintain XAML" approach. The main things we needed on this grid still worked under these conditions (i.e. inline editing, selection, validation and frozen columns (now rows). We were able to disable things that would have been problematic (i.e. sorting, grouping, column sizing etc.) and found a workaround for a side-effect of the rotation, which was the grid got confused when attempting to scale to the size of the available space. This was due to height and width being essentially reversed and we found a way to bind to the actualHeight and actualWidth of the containing framework element as a means to fix it.
Tags
GridView
Asked by
Alex
Top achievements
Rank 1
Answers by
Milan
Telerik team
Alex
Top achievements
Rank 1
Share this question
or