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
926
multiple grouping in xamdatagrid
posted

Hello,

How can we get the multiple grouping done in xamdatgrid ?Rather I need a hierarchail data in the grid.

My resultsets from the service gives me all the records in a plain gridview.I need to group it by "Name" and "Submitted on" fields.And I need both the fields on the same line. Can we do this ?

I am trying to bind xamdatagrid using WCF service.

Code in WCF service:

Public Function Raise_Request_Records_Summary(ByVal Completion_Level As Int16) As DataTable Implements WCF_Service_Pay_Raise_Request.Raise_Request_Records_Summary

Dim Result As DataTable = New DataTable

Try

Dim TempTable As New DataTable

Dim SQL_Statement As String = "EXEC STORED PROCEDURE"

Dim MySQLConnection As New SqlClient.SqlConnection(AcctTools_Connection)

Dim MySQLCommand As New SqlClient.SqlCommand(SQL_Statement, MySQLConnection)

MySQLCommand.Parameters.Add("@Completion_Level", SqlDbType.VarChar, 5)

MySQLCommand.Parameters(0).Value = Completion_Level

Dim MyDataAdapter As New SqlClient.SqlDataAdapter(MySQLCommand)

MyDataAdapter.Fill(TempTable)

Result = TempTable.Clone

'Cleanup!

MyDataAdapter.Dispose()

MySQLCommand.Dispose()

MySQLConnection.Dispose()

Catch ex As Exception Report_Error("An error occurred while looking up the Pay Raise record summary. The message was: " + ex.Message)

End Try

Result.TableName = "Raise_Request_Records_Summary"

Return Result

End Function

CODE IN THE PAGE_LOADED:

Dim Completion_Level As Int16 = 2

If chk_Hide_Closed.IsChecked Then Completion_Level = 1

Dim Client As New AEDEV_WCF.AEDEV_Service_Pay_Raise_RequestClient Dim Display_Table As DataTable = Client.Raise_Request_Records_Summary(Completion_Level)

Client.Close()

XamDataGrid1.DataSource = Display_Table.Rows

I NEED GRID TO DISPLAY THIS:

Band1: Name(ABC), Submitted on

Band2: All the data under(ABC)

How can I achieve this ?

Thanks

 

 

  • 28464
    posted

    Hello,

    I think what you need is documented here:

    Programmatically Sort and Group Fields 

    http://help.infragistics.com/Help/NetAdvantage/WPF/2008.2/CLR3.X/html/xamData_Programmatically_Sort_and_Group_Fields.html

    using Infragistics.Windows.DataPresenter;
    ...
    FieldSortDescription deptSort = new FieldSortDescription();
    deptSort.Direction = System.ComponentModel.ListSortDirection.Descending;
    deptSort.FieldName = "department";
    deptSort.IsGroupBy = true;

    FieldSortDescription salarySort = new FieldSortDescription();
    salarySort.Direction = System.ComponentModel.ListSortDirection.Descending;
    salarySort.FieldName = "salary";

    //Code for xamDataGrid
    this.xamDataGrid1.FieldLayouts[0].SortedFields.Clear();
    this.xamDataGrid1.FieldLayouts[0].SortedFields.Add(deptSort);
    this.xamDataGrid1.FieldLayouts[0].SortedFields.Add(salarySort);

    //Code for xamDataCarousel
    this.xamDataCarousel1.FieldLayouts[0].SortedFields.Clear();
    this.xamDataCarousel1.FieldLayouts[0].SortedFields.Add(deptSort);
    this.xamDataCarousel1.FieldLayouts[0].SortedFields.Add(salarySort);

    //Code for xamDataPresenter
    this.xamDataPresenter1.FieldLayouts[0].SortedFields.Clear();
    this.xamDataPresenter1.FieldLayouts[0].SortedFields.Add(deptSort);
    this.xamDataPresenter1.FieldLayouts[0].SortedFields.Add(salarySort);
    ...