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
785
Initial sort on page load
posted

I've tried to follow the example code, but my current result is that the sort field does get added to the GroupSettings area above the grid, but the grid is not grouped.   I can then drag the same column name up to the grouping area... the grid becomes grouped, but the grouping area shows the column header twice.

Any ideas or suggestions would certainly be appreciated.

-Gary

Parents
No Data
Reply
  • 785
    posted

    p.s.  here is my code:

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    <

     

     

    ig:WebHierarchicalDataGrid ID="WebHierarchicalDataGrid1" runat="server"

     

     

    DataSourceID="WebHierarchicalDataSource1" Height

    ="700px"

     

     

    Width="1100px" AutoGenerateColumns="False"

     

     

    DataMember="LinqDataSource1_DefaultView" Key="DefaultView"

     

     

    DataKeyFields="TaskTitle" EnableRelativeLayout="True" ShowFooter

    ="True">

     

     

     

     

    <Columns

    >

     

     

    <ig:BoundDataField DataFieldName="TaskStatus" DataType="System.String"

     

     

    Key

    ="BoundColumn_0">

     

     

    <Header Text="Status"

    />

     

     

    </ig:BoundDataField

    >

     

     

    <ig:BoundDataField DataFieldName="TaskTitle" DataType="System.String"

     

     

    Key

    ="BoundColumn_1">

     

     

    <Header Text="Title"

    />

     

     

    </ig:BoundDataField

    >

     

     

    <ig:BoundDataField DataFieldName="TaskOwner" DataType="System.String"

     

     

    Key

    ="BoundColumn_2">

     

     

    <Header Text="Owner"

    />

     

     

    </ig:BoundDataField

    >

     

     

    <ig:BoundDataField DataFieldName="TaskID" DataType="System.Int32" Hidden="True"

     

     

    Key

    ="BoundColumn_3">

     

     

    <Header Text="BoundColumn_3"

    />

     

     

    </ig:BoundDataField

    >

     

     

    <ig:BoundDataField DataFieldName="TaskDueDate" DataType="System.DateTime"

     

     

    Key

    ="BoundColumn_4">

     

     

    <Header Text="Due Date"

    />

     

     

    </ig:BoundDataField

    >

     

     

     

     

    </Columns

    >

     

     

    <

     

     

    CollapseButton AltText="Collapse Row"></CollapseButton

    >

    <

     

     

    ExpandButton AltText="Expand Row"></ExpandButton

    >

     

     

     

    <Behaviors

    >

     

     

    <ig:Selection Enabled="true" CellClickAction="Row" RowSelectType

    ="Single">

     

     

     

    </ig:Selection

    >

     

     

    </Behaviors

    >

     

     

     

    <GroupingSettings EnableColumnGrouping="True" GroupAreaVisibility="Visible" InitialRowExpandState="Collapsed" GroupedRowTextMask

    ="{0}: {1}">

     

    <

     

     

    RemoveButton AltText="Ungroup Column"></RemoveButton

    >

     

     

    </GroupingSettings

    >

     

     

    </ig:WebHierarchicalDataGrid>

    using

     

    System;

    using

     

    System.Collections.Generic;

    using

     

    System.Web;

    using

     

    System.Web.UI;

    using

     

    System.Web.UI.WebControls;

    using

     

    Infragistics.Web.UI.GridControls;

    public

     

    partial class Default3 : System.Web.UI.Page

    {

     

    protected void Page_Init(object sender, EventArgs e)

    {

     

    }

     

    protected void Page_Load(object sender, EventArgs e)

    {

     

    if (!Page.IsPostBack)

    {

     

    ColumnGroupingSetting setting = new ColumnGroupingSetting();

    setting.ColumnKey =

    "TaskStatus";

    setting.GroupComparer =

    new AlphabetGroupComparer();

     

    this.WebHierarchicalDataGrid1.GroupingSettings.ColumnSettings.Add(setting);

     

    this.WebHierarchicalDataGrid1.GroupingSettings.GroupedColumns.Add("TaskStatus");

    }

     

    else

     

    this.WebHierarchicalDataGrid1.GroupingSettings.ColumnSettings["TaskStatus"].GroupComparer = new AlphabetGroupComparer();

    }

     

    public class AlphabetGroupComparer : GroupEqualityComparer<string>

    {

     

    public override bool Equals(string x, string y)

    {

     

    if (x.Substring(0, 1).ToLower() == y.Substring(0, 1).ToLower())

     

    return true;

     

    return false;

    }

     

    public override string GroupName(string value)

    {

     

    if (value.Length == 0)

     

    return string.Empty;

     

    return value.Substring(0, 1).ToUpper();

    }

    }

    }

     

Children