RadGridView. How do I get an effect similar to the demo?

5 posts, 0 answers
  1. Czeshirecat
    Czeshirecat avatar
    66 posts
    Member since:
    Jun 2016

    Posted 22 May 2017 Link to this post

    Hi. I want to display a gridview almost identical to the way it's displayed in the demo. I've spent hours trying to compare files but I still can't get the same behaviour.

    I do have a couple of changes that I want.

    There's only 3 columns in the datasource. CreationDate (datetime a record was created), ResultString (a string displaying a pass fail result), and a calculated column Date, which is the field I want to group on, which is just the date portion of CreationDate.

    1) I want the grid to be set up grouped on the Date column automatically, as you've done with the City column in the demo. But I don't want the user to see the Grouping bar, or the Date column in the grid as it's only there for grouping purposes.

    2) I can't see how the demo app gets the "City" button in the grouping bar. I can't emulate that at all. How is that done please? And can all that be hidden?

    3) Another problem is formatting. If I show the Date column, the values in that column format correcty e.g. "01/02/2017", just showing short date with no time. But if I drag the Date column to the group bar then the group dividers show the time element e.g. "01/02/2017 00:00:00".
    Trying to fix this I've added a Group Descriptor to the properties for the grid for Group, with format {0~:1d} but it doesn't seem to work (and also keeps disappearing from my Designer file)

    Can you help please?

     

  2. Czeshirecat
    Czeshirecat avatar
    66 posts
    Member since:
    Jun 2016

    Posted 22 May 2017 in reply to Czeshirecat Link to this post

    Sorry, I forgot to say. I want the view of the data grouped already just like it is in the demo, without the user having to do it manually
  3. Dimitar
    Admin
    Dimitar avatar
    2831 posts

    Posted 23 May 2017 Link to this post

    Hello Claire,

    I am not sure which example you are using. Could you please specify that?

    1. You can add GroupDesriptors: Setting Groups Programmatically | RadGridView.

    2. You can hide the group bar by setting the ShowGroupPanel property.

    3. You can use the GroupSummaryEvaluate event:
    private void RadGridView1_GroupSummaryEvaluate(object sender, GroupSummaryEvaluationEventArgs e)
    {
        if (e.SummaryItem.Name == "Date")
        {
            e.FormatString = String.Format("Group by date: {0}", ((DateTime)e.Value).ToShortDateString());
        }
    }

    I hope this will be useful. Let me know if you have additional questions.

    Regards,
    Dimitar
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  4. Czeshirecat
    Czeshirecat avatar
    66 posts
    Member since:
    Jun 2016

    Posted 31 May 2017 in reply to Dimitar Link to this post

    Hi, it's the Winforms, DemoAppsHub, GridExample, grid view.

    At design time, the group by bar already contains a "City" button. I can't see how this has been done. I've studied the code, and the designer.cs file.

  5. Dimitar
    Admin
    Dimitar avatar
    2831 posts

    Posted 31 May 2017 Link to this post

    Hi Claire,

    The group is added at design time. The attached image shows the code for it. The article specified in my previous post describes exactly how you can achieve this.

    Should you have any other questions do not hesitate to ask.

    Regards,
    Dimitar
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top