JJ
Jisha Joy
Syncfusion Team
May 19, 2008 08:43 AM UTC
Hi James,
Hide Rows in GridGroupingControlThis 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.htmPlease let me know if this helps.
Regards,
Jisha
JL
James Lai
May 19, 2008 09:32 AM UTC
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
JL
James Lai
May 21, 2008 07:24 AM UTC
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
JJ
Jisha Joy
Syncfusion Team
May 21, 2008 07:34 AM UTC
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
JL
James Lai
May 21, 2008 08:41 AM UTC
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
JL
James Lai
May 22, 2008 02:32 AM UTC
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
SR
Sri Rajan
Syncfusion Team
May 23, 2008 02:40 AM UTC
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.htmPlease let me know if this helps.
Best Regards,
Srirajan
JL
James Lai
May 23, 2008 07:43 AM UTC
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
JJ
Jisha Joy
Syncfusion Team
May 23, 2008 12:46 PM UTC
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
JL
James Lai
May 26, 2008 06:51 AM UTC
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
JJ
Jisha Joy
Syncfusion Team
May 26, 2008 12:23 PM UTC
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
AD
Administrator
Syncfusion Team
May 28, 2008 08:51 AM UTC
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
AP
Arthur Panggabean
May 30, 2008 01:56 AM UTC
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,
JL
James Lai
May 30, 2008 02:08 AM UTC
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
JJ
Jisha Joy
Syncfusion Team
June 3, 2008 09:11 AM UTC
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
JL
James Lai
June 10, 2008 03:45 AM UTC
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
JJ
Jisha Joy
Syncfusion Team
June 18, 2008 12:38 PM UTC
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
JL
James Lai
June 26, 2008 03:36 AM UTC
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