Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
615
Default Sort with Grouping
posted

Hi,

I have a grid with both a fixed Grouping (the user doesn't change the grouped column) and a default sort order.  Let's call the Grouping field FieldA and the default sort order FieldA + FieldB.  I haven't found a way to apply the default sort order after the Grouping has occurred.  The data returned to the control is initially sorted by FieldA + FieldB, but with the grouping that sorting is gone by the time the page renders (the data is grouped as I expect).  I can have Javascript restore it, but that requires another trip back to the server.  What do you think?

Ross Bailey

Parents
No Data
Reply
  • 37874
    posted

    Hi Ross,

     

    It has been some time since you posted, but in case you still need assistance I will be glad to help.

     

    You would not be able to group and then sort by the same column – grouping by FieldA for example, would also apply sorting by this column. You could set the sorting direction when applying default grouping:

     

    protected void Page_Load(object sender, EventArgs e)

    {

        WebHierarchicalDataGrid1.GroupingSettings.GroupedColumns.Add("FieldA", GroupingSortDirection.Descending);

    }

     

    Then you could sort by FieldB in RowIslandDataBinding event:

     

    Sorting sort = e.RowIsland.Behaviors.Sorting;

    sort.SortedColumns.Add("FieldB", Infragistics.Web.UI.SortDirection.Descending);

     

    Let me know if you have any further questions.

Children