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
335
Show/Hide child card view columns depending on column data
posted

Hi

I have an ultragrid with a parent band having cardview children.

What I would like to do is hide a cardview column if there is no data for that column, while keeping the column for other parent records if the column does have data. (I've attached a picture as it doesn't look like my pasted picture - which might be below - will show)

In initializeRow, for any row in band 2 I tried the following, but it hides the Cost for all child records, not just the cost for the second parent. Is what I'm wanting to do possible?

private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)

{

    if(e.Row.Band.Index == 1)

         {

         ParentObject parentObject = e.Row.ParentRow.ListObject as ParentObject;

         bool showCostColumn = false;

         foreach(ChildObject childObject in parentObject.LineItems)

                   {

              if (childObject.Cost.HasValue)

                   showCostColumn = true;

                    }

          e.Row.Cells["Cost"].Column.Hidden = !showCostColumn;

        }

}

Thanks for any advice that you can offer.

Steve

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi Steve,

    The column object applies to the entire band across all islands. So you cannot hide a column under one parent without hiding it under all of them. There's no way to do that.

    However, if you just want to hide empty cells in your card, you could set the band.CardSettings.Style to VariableHeight.

Children