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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Way to hide/show stacked headers based on some condition

Thread ID:

Created:

Updated:

Platform:

Replies:

118901 Apr 21,2015 03:43 PM UTC Apr 23,2015 07:32 AM UTC WinRT 3
loading
Tags: SfDataGrid
Vasanth
Asked On April 21, 2015 03:43 PM UTC

Hi,

Is there a way to hide/show stacked headers in SfDataGrid based on some condition by user input in one of the Editable columns? Currently I can able to reset StackedHeaderRows collections to achieve hiding like below:

AdlDataGrid.StackedHeaderRows = new StackedHeaderRows();

and readding stacked columns when conditions met to show it back. Wondering if there is a better way to show/hide it.

Ganeshkumar Lingappan [Syncfusion]
Replied On April 22, 2015 01:33 PM UTC

Hi Vasanth,

Thank you for Contacting Syncfusion support.

We have analyzed your query and you can achieve your requirement by changing the height for the StackedHeaderRows. To hide the StackedHeaderRow you have to set the height as zero and to Show the StackedHeaderRow you have to set the default height. We have prepared the sample to hide and show the StackedHeader based on Editing the Cell and it is attached in below mentioned location. Please Refer the below code-snippet.

void sfdatagrid_CurrentCellEndEdit(object sender, Syncfusion.UI.Xaml.Grid.CurrentCellEndEditEventArgs args)

{

//GetVisualContainer Helps to change the RowHeight value for the Stacked Header.

var visualcontainer = sfdatagrid.GetVisualContainer();

var grid = sender as SfDataGrid;

//GetRecordAtRowIndex helps to Get the Record value for the Particular RowIndex.

var rowData = grid.GetRecordAtRowIndex(args.RowColumnIndex.RowIndex);

//GetPropertyAccessProvider helps to get the Cell Value for the Particular column.

var celltext = grid.View.GetPropertyAccessProvider().GetValue(rowData, "ProductName");

if (celltext != null && celltext.Equals("HardWare"))

visualcontainer.RowHeights[0] = 0;

else

visualcontainer.RowHeights[0] = 45;

visualcontainer.InvalidateMeasure();

}

Sample Link : http://www.syncfusion.com/downloads/support/forum/118901/StackedHeaderRow102966953.zip

Please let us know if you require further assistance.

Regards,

Ganeshkumar



Vasanth
Replied On April 22, 2015 02:13 PM UTC

perfect, thanks!!

Saranya CJ [Syncfusion]
Replied On April 23, 2015 07:32 AM UTC

Hi Vasanth,

We are glad to know that your reported issue works at your end. Please let us know if you require further assistance.

Regards,
Saranya

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;