Best practice approach to GridView orientation

3 posts, 1 answers
  1. Alex
    Alex avatar
    8 posts
    Member since:
    Nov 2011

    Posted 15 Nov 2011 Link to this post

    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. Answer
    Milan
    Admin
    Milan avatar
    1989 posts

    Posted 22 Nov 2011 Link to this post

    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 >>

  3. Alex
    Alex avatar
    8 posts
    Member since:
    Nov 2011

    Posted 24 Nov 2011 Link to this post

    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.
Back to Top