We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Hide row under a group

hi,

Enclosed is a sample. 

a) I would like to display grouped row **Empty Group**, but would like nothing to appear under it showing that group as empty. This is to show there is a group called Empty Group but there is nothing inside it. I tried by showing empty cells or by collapsing related VirtualizingCellsControl but cannot get rid of empty line under it. Please advice

b) Setting AutoExpandGroups="True" in xaml is having a refresh issue with Expander direction. If groups are auto expanded from loaded event, it works good.

Thanks


SfGrid_3708d108.zip

3 Replies

PS Prakash Selvaraj Syncfusion Team April 23, 2013 12:37 PM UTC

Hi Bhavani,

 

Sorry for the inconvenience caused.

 

We have analysed your query,

 

For Query a):

You can achieve your requirements by cancelling the GroupExpanding event for the empty group. We have created a simple sample to achieve this. Please refer the below sample.

Sample link: SfGrid.zip

 

For Query b):

We were able to reproduce the issue, we will fix the issue and it will be available in our next release which is expected by mid of May 2013.

 

Regards,

Prakash S.



BS bhavani sangannagari April 23, 2013 06:32 PM UTC

Thanks for reply. I get the following exception.

System.NullReferenceException
   at Syncfusion.UI.Xaml.Grid.RowGenerator.CreateDataRow(Int32 rowIndex, VisibleLinesCollection visibleColumns)
   at Syncfusion.UI.Xaml.Grid.RowGenerator.EnsureRows(VisibleLinesCollection visibleRows)
   at Syncfusion.UI.Xaml.Grid.VisualContainer.EnsureItems(Boolean ensureColumns)
   at Syncfusion.UI.Xaml.Grid.VisualContainer.MeasureOverride(Size constraint)   at Windows.UI.Xaml.UIElement.Measure(Size availableSize)
   at Syncfusion.UI.Xaml.Grid.ScrollableContentViewer.MeasureOverride(Size availableSize)

To reproduce it, just place the grid within scrollviewer like below. I need to be able to scroll through multiple grids on a page, hence need a scrollviewer. Please advice

 <ScrollViewer Grid.Row="1">
                <syncfusion:SfDataGrid x:Name="datagrid"
                               AutoGenerateColumns="True"
                               ShowColumnWhenGrouped="False"
                               ColumnSizer="Star"
                               ItemsSource="{Binding Stocks}">

            <syncfusion:SfDataGrid.GroupColumnDescriptions>
                <syncfusion:GroupColumnDescription ColumnName="Account" />
            </syncfusion:SfDataGrid.GroupColumnDescriptions>
        </syncfusion:SfDataGrid>
        </ScrollViewer>

I tried collapsing all groups and expanding just the groups having valid rows, but this approach is having refresh issues. Sample code i tried is as below.  

         datagrid.CollapseAllGroup();
            if (this.datagrid.View != null)
            {                 
                    foreach (var item in datagrid.View.TopLevelGroup.Groups)
                    {
                        if (item.Records.Count > 1)
                        {
                            item.IsExpanded = true;
                        }
                    }
            }


PS Prakash Selvaraj Syncfusion Team April 24, 2013 09:04 AM UTC

Hi Bhavani,

 

Sorry for the inconvenience caused.

 

We are able to reproduce the reported issues. We will fix this issue and it will be available in our next release which is expected by mid of May 2013. At present you can use the below work around to achieve your requirements. We have created the simple sample based on that, Please refer the below sample.

 

Code Snippet [C#]:

var updaterowcount = this.datagrid.GetType().GetRuntimeMethods().FirstOrDefault(method => method.Name == "UpdateRowCount");

updaterowcount.Invoke(datagrid, null);

 

Sample Link: SfGrid.zip

 

Please let us know if you need further assistance.

 

Regards,

Prakash S.


Loader.
Live Chat Icon For mobile
Up arrow icon