Ennesima77
2022-03-16T13:06:24Z
Dear All,
as subject I need to exclude or hide some child group when value is "null" or empty.
I use a dataset from SQL to fill my grid
Cattura1.PNG

Click to View Image25 View(s)


and i need to group some rows.
at the moment I have this result, but i need to hide or delete the null value.
Cattura2.PNG

Click to View Image27 View(s)


how can i do this?

Thank you for your cooperation.
Igor/10Tec
2022-03-16T15:46:35Z
Perhaps, you can do this work in an event handler of the AfterContentsGrouped event. You could enumerate all grid rows in this event handler and hide the group rows with the null group values. However, a couple of tricky questions will appear.

First: how to know whether the group value in a row is null? Perhaps, you can analyze the group row text (the value of the corresponding row text cell) and check whether it ends with ":".

Second: what to do with the row level of child rows whose parents were hidden?

Perhaps, you need another visual representation of your data instead of what you are going to implement.
Ennesima77
2022-03-17T08:28:28Z
Originally Posted by: Igor/10Tec 

Perhaps, you can do this work in an event handler of the AfterContentsGrouped event. You could enumerate all grid rows in this event handler and hide the group rows with the null group values. However, a couple of tricky questions will appear.

First: how to know whether the group value in a row is null? Perhaps, you can analyze the group row text (the value of the corresponding row text cell) and check whether it ends with ":".

Second: what to do with the row level of child rows whose parents were hidden?

Perhaps, you need another visual representation of your data instead of what you are going to implement.



First of All Thanks for your answer, it was so useful for me.
Cattura3.PNG

Click to View Image22 View(s)


this is my final result, and it is exactly what i need.


 For Each rowHeader As TenTec.Windows.iGridLib.iGRow In igMain.Rows

            With rowHeader
                If rowHeader.RowTextCell.Text.StartsWith("DES_LIV_") Then
                    If rowHeader.RowTextCell.Text.EndsWith("@null@") Then
                        rowHeader.Visible = False
                    End If
                End If
            End With

        Next

this is the code insert into AfterContentsGrouped event.
to be sure to get the null value I added a coalesce on SQL query.
Igor/10Tec
2022-03-17T11:08:09Z
I would just wrap this code snippet with the BeginUpdate/EndUpdate method calls to speed up the process.