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.
Unfortunately, activation email could not send to your email. Please try again.

Hiding rows in GridGroupingControl

Thread ID:

Created:

Updated:

Platform:

Replies:

73774 May 19,2008 03:54 AM Jun 25,2008 11:36 PM Windows Forms 18
loading
Tags: GridControl
James Lai
Asked On May 19, 2008 03:54 AM

hi,

Is there any way to hide rows in a GGC?

I can only hide columns but not rows with TableDescriptor.

The Rows.Hidden[] array only works for GridControl but not GridGrouping Control.

Any ideas?

Thanks,
James


Jisha Joy [Syncfusion]
Replied On May 19, 2008 04:43 AM

Hi James,

Hide Rows in GridGroupingControl

This can be achieved by the following code:

//Hide Rows
this.gridGroupingControl1.TableModel.HideRows[2] = false;
this.gridGroupingControl1.TableModel.HideRows[3] = false;
gridGroupingControl1.Refresh();

Please refer the sample:

http://websamples.syncfusion.com/samples/Grid.Windows/I42694/main.htm

Please let me know if this helps.
Regards,
Jisha


James Lai
Replied On May 19, 2008 05:32 AM

Hi Jisha,

Thanks for your help. Unfortunately that does not seem to work.

I set a break point before and after the following line of code and observed that the value is not even changed - it remains false. Of course the row is not hidden.

this.gridGroupingControl1.TableModel.HideRows[2] = true;

Regards,
James



James Lai
Replied On May 21, 2008 03:24 AM

Hi Jisha,

Tried the example from your link, which works.

I thought it was the TableDescriptors AllowEdit = false and Appearance.AnyCell.Readonly = true causing the problem. Changed it back, no luck.

I would imagine it is caused by some similar settings. Any ideas would be appreciated.

Thanks.

Regards,
James




Jisha Joy [Syncfusion]
Replied On May 21, 2008 03:34 AM

Hi James,

Thank you for your update.

Try to call Refresh method of gridGroupingControl after setting HideRows to true and let me know if this helps.


gridGroupingControl1.Refresh();


Regards,
Jisha



James Lai
Replied On May 21, 2008 04:41 AM

Hi Jisha,

Yes I have already called Refresh(), but that does not help.

For some reasons the value of HideRows wouln't get changed and stays false. No exception is thrown when I try to set it to true.

Regards,
James


James Lai
Replied On May 21, 2008 10:32 PM

Hi Jisha,

On some further testing, I think rows hiding does not work when a BindingSource is used. Am I correct? Are there any workarounds?

Thanks.

Regards,
James


Sri Rajan [Syncfusion]
Replied On May 22, 2008 10:40 PM

Hi James,

Thank you for your interest in Syncfusion products.

You need to handle TableModel.QueryRowHeight event, then set the e.Size as 0 and also set the e.Handled as true to hide a row in GridGroupingControl. Please refer the below code for more details.

private void buttonAdv1_Click(object sender, EventArgs e)
{
this.gridGroupingControl1.TableModel.QueryRowHeight += new GridRowColSizeEventHandler(TableModel_QueryRowHeight);
this.gridGroupingControl1.Refresh();
}

void TableModel_QueryRowHeight(object sender, GridRowColSizeEventArgs e)
{
if (e.Index == 5)
{
e.Size = 0;
e.Handled = true;
}
}


Here is the minimal sample which implements this task.
http://websamples.syncfusion.com/samples/grid.windows/F73774/main.htm

Please let me know if this helps.

Best Regards,
Srirajan


James Lai
Replied On May 23, 2008 03:43 AM

Hi Srirajan,

Thanks for your help, hiding works now.

However, GridRowColSizeEventArgs gives very little information on the actual data rows. e.Index seems to give the index of the physical grid (including rows for dataset name, summary, multiple header rows...) instead of data rows.

How can I check the data in the current row when the QueryRowHeight event is fired? Say, I want to hide a row when the value in column "Amount" is zero.

Thanks.

Regards,
James


Jisha Joy [Syncfusion]
Replied On May 23, 2008 08:46 AM

Hi James,

This can be achieved by using the following code snippets. Please refer the code:


void TableModel_QueryRowHeight(object sender, GridRowColSizeEventArgs e)
{
GridTableControl gc = this.gridGroupingControl1.GetTableControl("MyTable");

if (e.Index == 4 && gc.Model[4, 1].Text== "row0 col0")
{
e.Size = 0;
e.Handled = true;
}
}



Please try this and let me know if this helps.

Regards,
Jisha


James Lai
Replied On May 26, 2008 02:51 AM

Hi Jisha,

Thanks for your suggestion. I could get the cell data with the Model[rowIdx, colIdx] array.

The problem with this approach is, I have to store the column index of the column I want to look at, and implement the VisibleColumns.Changing and VisibleColumns.Changed events to track to column index changes when re-arranging columns.

Is there a direct way of using the column MappingName to get the cell data (or column index then subsequently cell data)?

Thanks.

Regards,
James


Jisha Joy [Syncfusion]
Replied On May 26, 2008 08:23 AM

Hi James,

Thank you for your update.

Please refer the code:

void TableModel_QueryRowHeight(object sender, GridRowColSizeEventArgs e)
{
if (e.Index==4 && this.gridGroupingControl1.Table.GetTableCellStyle(gridGroupingControl1.Table.Records[0], "Col1").Text == "row0 col1" )
{
e.Size = 0;
e.Handled = true;
}
}

Let me know if this helps.

Regards,
Jisha


Administrator [Syncfusion]
Replied On May 28, 2008 04:51 AM

Hi Jisha,

I have tried your sample code, but that does not work. The text field always returns "0".

My workaround of tracking the column ordering kind of worked so it is not the biggest problem for now. Instead, I am seeing some performance issues which render the whole grid quite unusable.

Our grid contains quite a large number of rows. We want to hide rows with "Amount" = 0. So if we sort with the column "Amount" and then scroll down, it becomes extrememly slow when we scroll through the zero point as we are actually scrolling pass hundreds of rows.

I am not sure if it only happens in this workaround of setting height = 0. Would the same problem happen if we get the "real" hide function to work?

Thanks.

Regards,
James





Arthur Panggabean
Replied On May 29, 2008 09:56 PM

Hi,
if you're using a BindingSource, can't you just filter the undesired records using BindingSource.Filter property instead of hiding them? You can use the 'RecordFilters' functionality in GGC too, there are plenty of posts in this forum on that.

Cheers,


James Lai
Replied On May 29, 2008 10:08 PM

Hi Mike,

Thanks for your suggestion, but filtering
does not work for me.

I want to hide rows with zeros in one of the columns, and show the totals for some other columns at the same time.

Regards,
James


Jisha Joy [Syncfusion]
Replied On June 3, 2008 05:11 AM

Hi James,

Render the whole grid quite unusable

Please try to use the following code snippets in the from load event and let me know if this helps.


private void Form1_Load(object sender, EventArgs e)
{
this.gridGroupingControl1.Engine.CounterLogic = EngineCounters.FilteredRecords;
}


Regards,
Jisha



James Lai
Replied On June 9, 2008 11:45 PM

Hi Jisha,

I have tried your code but that does not improve performance. When I sort and order the zero height rows together scrolling is extremely slow.
Please advise. Thanks.

Regards,
James


Jisha Joy [Syncfusion]
Replied On June 18, 2008 08:38 AM


Hi James,


By default, the GridGroupingControl does not support rows with individualized rowheights. To get this support, you need to add a custom GridEngine as in the Syncfusion Browser sample ResizableRows.

..\\Syncfusion\EssentialStudio\6.2.0.40\Windows\Grid.Grouping.Windows\Samples\2.0\FeaturedSamples\ResizableRows

Regards,
Jisha



James Lai
Replied On June 25, 2008 11:36 PM

Hi Jisha,

The problem is finally solved by using filter and then setting the IgnoreRecordFilterCriteria property.

I can get my desired result - hiding unwanted columns while still including them in the total.

Thanks for your suggestion anyway.

Regards,
James


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.

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.

;