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
65
Custom Text in Group Row
posted

I am using a WebHierarchicalDataGrid to group data.  I have the columns and bands configured and they are displaying the data as they should.   

I would like to customize the text in the group row copied and pasted the following code to thee GroupedRowInitialized event.as follows:


If e.GroupedRow.ColumnGroupedBy.Key = "StopNum" Then

If e.GroupedRow.Value = DBNull.Value Then
'' Get number of items from default text
'Dim numItems As String = e.GroupedRow.Text.Substring(e.GroupedRow.Text.Length - 3, 3)
'e.GroupedRow.Text = "Reports to no one " & numItems
Else
Dim numItems As String = e.GroupedRow.Text.Substring(e.GroupedRow.Text.Length - 3, 3)
' Get value being grouped by
Dim value As Integer = CInt(e.GroupedRow.Value)
' Get the row with EmployeeID equal to the value being grouped by from the ReportsTo column.
' This returns the row for the employee that the rows that are being grouped reports to.
Dim record As GridRecord = Me.WebHierarchicalDataGrid1.Rows.FromKey(New Object() {value})
If record IsNot Nothing Then
' Get the name of the person to report to
Dim name As String = (record.Items(2).Value.ToString() & " ") + record.Items(2).Value.ToString()
e.GroupedRow.Text = ("Reports to " & name & " ") + numItems
End If
End If
End If

All of the records in the bands are grouped by 'StopNum'

The problem at this point that i am having is it does not appear that the GroupedRowInitialized is firing.     I am new to infragistics and and hoping that i can get some help with first figuring out why this is not firing and then configuring the custom text that i would like to appear.   If i can get the grid to work the way i want i am going to upgrade to the most recent version of the ultimate subscription.

any helper would be greatly appreciated.

Parents
  • 1700
    Offline posted

    Hello Mike,

    It seems that you have followed the following topic in our documentation, which describes how to create a custom text for the group by rows using the GroupedRowInitialized. One reason why it may not work for your gird is that your gird would have a different data source you would have to adapt the example code to your data by placing the right fields as well as column indexes.

    If you have done this, could you let me know if the event triggers when you place a breakpoint, since dragging the column header to the GroupByArea should trigger the event?

    Additionally I have prepared a small sample that provides a simplified version of this example presented in the documentation. On my side everything seems to behave as expected and the event fires every time a column has been dragged to the GroupByArea.

    I am attaching the sample below, please test the sample on your side and let me know if you have any questions or concerns.

    Regards,
    Ivan Kitanov

    GroupByRowSample.zip

Reply Children