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
2589
Child rows disappear
posted

Hello,

I'm not sure I with my English can correctly explain what's going on but I will try :)

I have a grid which displays nested tables, and filter row is turned on. When some rows in datasource has child rows or child collection is not null, I can see an expand indicator. When a child list is null, I don't see indicator. So everything is ok with this, I suppose. But there is a situation when this won't work correctly. For example:

My grid datasource is a collection of objects which were created using Reflection. And sometimes I do a "special" filtering within child rows. Special because i don't use a XamGrid filtering. What I do is I "enter" a child collection and filter some data just inside a collection, using LINQ. When output contains at least a single line, everything works ok, but when collection becomes empty (.Count == 0), child rows completely disappear and expand indicator disappears too. I think this is not a correct behavior, because when child collection is not null, it must be still expandable because filter row is present.

I cannot give you a sample code because it's almost impossible to reproduce this functionality in a new project. And please don't ask me why I'm not using a XamGrid filtering feature in this case, this is a political decision made by somebody else, not me :)

I would be gratefull for any ideas about that.

  • 21382
    Suggested Answer
    posted

    The behavior you are seeing is by design.  When the List that populates the rows is evaluated we check to see how many rows are in there prior to our evaluation of the filters.  In your case you already took out the rows so we see zero rows and have no way of knowing otherwise.

     

    To workaround this in your case you could try turning on an AddNewRow on the child band level.  Set the row height of the add new row to be zero.  This would force the expansion indicator to be visible at all times.

     

    Something like

     

    <ig:ColumnLayout Key="PersonStuff" TargetTypeName="PersonStuff">

                        <ig:ColumnLayout.AddNewRowSettings>

                            <ig:AddNewRowSettingsOverride  AddNewRowHeight="0" AllowAddNewRow="Top" Style="{StaticResource ANR}"></ig:AddNewRowSettingsOverride>

                        </ig:ColumnLayout.AddNewRowSettings>

                    </ig:ColumnLayout>

     

    With a style defined

            <Style TargetType="igPrim:AddNewRowCellControl" x:Key="ANR" >

                <Setter Property="Visibility" Value="Collapsed"></Setter>

                <Setter Property="IsTabStop" Value="False"></Setter>

                <Setter Property="IsEnabled" Value="False" ></Setter>

            </Style>