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.
Syncfusion Feedback

limiting the no of rows in the grid.

Thread ID:

Created:

Updated:

Platform:

Replies:

32611 Aug 4,2005 01:15 PM UTC Aug 5,2005 02:07 PM UTC Windows Forms 8
loading
Tags: GridControl
Catinat Velmourougan
Asked On August 4, 2005 01:15 PM UTC

hi, I have a grid grouping grid. I have a requirement to limit the number of rows appearing on the grid. Say , for example I have a filter col1 >0 and I want to see only the first 10 rows and last 15 rows that satisfy this condition. How to go about it? I have applied the filter condition to the datasource.Is there any way to limit the number of rows from the grid? regards, Catinat

Catinat Velmourougan
Replied On August 4, 2005 02:36 PM UTC

hi clay, Is there some property which i can set? I have searched on the forums couldnt find anything. regards, catinat >hi, >I have a grid grouping grid. >I have a requirement to limit the number of rows appearing on the grid. >Say , for example I have a filter col1 >0 and I want to see only the first 10 rows and last 15 rows that satisfy this condition. How to go about it? > >I have applied the filter condition to the datasource.Is there any way to limit the number of rows from the grid? > >regards, >Catinat

Administrator [Syncfusion]
Replied On August 4, 2005 02:53 PM UTC

There is no property setting that would give you this behavior. There is a QueryRecordMeetsFilterCriteria event that you can use along with an unbound column to get this behavior. Here is a little sample that displays teh first 2 and last 2 records in a filter. http://www.syncfusion.com/Support/user/uploads/GGC_FilterRestrictions_b5c704ea.zip

Catinat Velmourougan
Replied On August 5, 2005 04:28 AM UTC

hi clay, I went through the sample.It solves my problem. In the sample, theres the following code snippet: //add unbound column to hold position in filter and hide it this.gridGroupingControl1.TableDescriptor.UnboundFields.Add("positionInFilter"); this.gridGroupingControl1.QueryValue += new FieldValueEventHandler(gridGroupingControl1_QueryValue); this.gridGroupingControl1.TableDescriptor.VisibleColumns.Remove("positionInFilter"); This column "positionInFilter" is not used anywhere.Can I know the purpose of this column? This led me to another approach.Say I can add an rownumber column when building the datasource table and then apply a filter rownum < 3 or rownum > rowcount - 2. Will this work? I just want your opinion on this approach. regards, Catinat

Catinat Velmourougan
Replied On August 5, 2005 06:48 AM UTC

What about these methods? Are they helpful? sfgAssetView is of type Syncfusion.Forms.Grid.Grouping.GridGroupingControl this.sfgAssetView.Table.TableModel.Rows.RemoveRange(0,5); this.sfgAssetView.Table.TableModel.RowCount = 10; When I set this I get the following error: Capgroup.IMSFI.Awb.Main.exe'': Loaded ''d:\cgc\awb\awbapp\awbmain\bin\debug\capgroup.imsfi.common.businesslogic.dll'', Symbols loaded. catched at Syncfusion.Windows.Forms.Grid.GridModelRowColOperations.RemoveRange(Int32 from, Int32 last) in :line 0 System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: count at Syncfusion.Collections.SFTable.RemoveRows(Int32 rowIndex, Int32 count) at Syncfusion.Windows.Forms.Grid.GridData.RemoveRows(Int32 rowIndex, Int32 count) at Syncfusion.Windows.Forms.Grid.GridModelRowOperations.DataRemoveRange(Int32 removeAt, Int32 count) at Syncfusion.Windows.Forms.Grid.GridModelRowColOperations.RemoveRange(Int32 from, Int32 last) >hi clay, > >I went through the sample.It solves my problem. >In the sample, theres the following code snippet: > >//add unbound column to hold position in filter and hide it > this.gridGroupingControl1.TableDescriptor.UnboundFields.Add("positionInFilter"); > this.gridGroupingControl1.QueryValue += new FieldValueEventHandler(gridGroupingControl1_QueryValue); > this.gridGroupingControl1.TableDescriptor.VisibleColumns.Remove("positionInFilter"); > >This column "positionInFilter" is not used anywhere.Can I know the purpose of this column? > >This led me to another approach.Say I can add an rownumber column when building the datasource table and then apply a filter rownum < 3 or rownum > rowcount - 2. Will this work? I just want your opinion on this approach. > >regards, >Catinat

Administrator [Syncfusion]
Replied On August 5, 2005 10:12 AM UTC

The unbound fields and QueryValue are not used. They were left over from another try at doing this task. They should be removed. Here is the changed sample. http://www.syncfusion.com/Support/user/uploads/GGC_FilterRestrictions_a1d45d30.zip The idea of filtering a row index column may not work for this reason. It is not the index of the record in the original table that needs to be tested. Instead, it is the index in the filtered results that needs to be considererd. So, you would somehow reset these index values everytime there was a filter but you would not be able to until the filter was completed. Then you would have to refilter. Sort of a chicken and egg problem.

Catinat Velmourougan
Replied On August 5, 2005 12:57 PM UTC

hi clay, Theres one more catch ( specific to our design) when we use this approach, the filter condition is not being applied to the grid, but we apply to the datasource of the grid.So we dont have any record filters. So the event( QueryRecordMeetsFilterCriteria)is not getting fired!!!! So how to go about in this scenario??? regards, catinat

Catinat Velmourougan
Replied On August 5, 2005 01:35 PM UTC

hi, This one works! Do you forsee anhy problems with this piece of code? for( int i = 0; i < this.sfgAssetView.Table.TableModel.RowCount; i++) { if ( i > 20) { this.sfgAssetView.Table.TableModel.Rows.Hidden[i] = true; } } But since it loops through entire set of rows once, we are looking at other ways.

Administrator [Syncfusion]
Replied On August 5, 2005 02:07 PM UTC

If you are not using the grid''s filter support, then trying to hide the rows will have to be done in some other way. If you are doing a sql query on your database to get the filtered results to display in the grid, I think you can set up the query to pull only a subset of the filter. Not really sure of teh syntax though. As far as dynamically hiding the rows, this may work for a simple flat table but there also may be scrollbar problems with nested tables and such if you are using them.

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

;