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 : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridGroupingControl and Sort Behavior

Thread ID:

Created:

Updated:

Platform:

Replies:

57995 Mar 15,2007 02:28 PM UTC Apr 5,2007 01:59 PM UTC WinForms 7
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On March 15, 2007 02:28 PM UTC

Hello,

I am using a GridGroupingControl bound to a strongly-typed entity collection as the datasource; the grid is set up as "TableOptions.ListBoxSelectionMode = SelectionMode.One". I have several columns sorted by default on the grid, and changes to the data generally result in a sort and re-display of the data, albeit with some UI issues.

I have attached a sample to facilitate reproducing my issues. Please reload the form when attempting to replicate, as the steps assume a fresh instance.

First Issue
1) Move to Row 5
2) Click the "Is Active" checkbox
3) Move to Row 4

Notice that both Row 4 (which has moved into position 5) and Row 3 (which has moved into position 4) are selected. I would like only Row 4 to maintain selection. I can achieve partial results by handling the "SelectedRecordsChanging" event and cancelling when appropriate, but the CurrentCell is moving off of the selected row.

Second Issue
1) Move to Row 1
2) Change the First Lookup Combo to the last item
3) Move to Row 2

Note that even though sorting is enabled on the target column, the sort does not occur. If I modify the checkbox columns (which are known to trigger a sort from the first issue), then the grid resorts, but the value which has been modified seems to have no bearing on the sort results. I would like the records to resort appropriately on "SelectedRecordsChanged" and maintain a single record selection. I have attempted to use the "Table.SimulateListChanged()" method, but I receive inconsistent behavior or end up with multiple records selected, as identified in the first issue.

Any help on these issues is appreciated.

Thanks.

GGC_Sorting.zip

Administrator [Syncfusion]
Replied On March 16, 2007 10:14 PM UTC

Hi John,

I am really sorry to inform you that I am not able to reproduce the issue in Essential version 4.4.0.51 with .Net 1.1 & 2.0. Please let me know What version of the Essential Grid and .Net framework are you using?.

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On March 19, 2007 02:32 PM UTC

Hi Haneef,

We are currently using Syncfusion version 4.101.0.58 with .NET framework version 1.1.

>Hi John,

I am really sorry to inform you that I am not able to reproduce the issue in Essential version 4.4.0.51 with .Net 1.1 & 2.0. Please let me know What version of the Essential Grid and .Net framework are you using?.

Best Regards,
Haneef

Name
Replied On March 27, 2007 02:44 PM UTC

Hi,

Is there any additional information on this request for assistance with regards to the GridGroupingControl and proper sorting behavior?

Thanks.

>Hi Haneef,

We are currently using Syncfusion version 4.101.0.58 with .NET framework version 1.1.

>Hi John,

I am really sorry to inform you that I am not able to reproduce the issue in Essential version 4.4.0.51 with .Net 1.1 & 2.0. Please let me know What version of the Essential Grid and .Net framework are you using?.

Best Regards,
Haneef

Jeba S [Syncfusion]
Replied On March 28, 2007 11:57 AM UTC

Hi John,

The GridGroupingControl has two types of selection mode.

Type 1: Row based selection
This selection support can be turned on by setting the grid.tableOptions.AllowSelections to something other than None. This selection functionality raises events like the grid.TableModel.SelectionChanging/Changed.

[c#]
this.gridGroupingControl1.TableControl.Selections.Add(GridRangeInfo.Row(3));

Type 2: Record based selection
This selection support is turned on by setting the grid.TableOptions.AllowSelections to None and setting the grid.TableOptions.ListBoxSelectionMode to something other than None.

[c#]
this.gridGroupingControl1.Table.SelectedRecords.Add(record);

Please refer to the following KB article for more details.
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=344

Best Regards,
Jeba.


Name
Replied On March 29, 2007 05:30 PM UTC

Hi Jeba,

Thank you for your response, but that does not address the issues that I am experiencing. I am having issues with maintaining proper record selection when the GridGroupingControl dynamically resorts based on changes to the data of the bound objects.

I have attached sample code and steps on how to replicate my issues, as well as statements on how I need the grid to function. Please see my initial post for the details.

Thanks.


Jeba S [Syncfusion]
Replied On April 3, 2007 01:11 PM UTC

Hi John,

Sorry for the delay.

Issue 1:
You can avoid the multiple selection issue using this code snippet:

if ((e.Action == SelectedRecordsChangedType.Added) && (e.Table.SelectedRecords.Count == 1))
{
e.Cancel=true;
}


Issue 2:
You can trigger the sort using the code snippet:

this.grdPrimary.Engine.ResetTable();


Here is the modified sample:
http://websamples.syncfusion.com/samples/Grid.Windows/F57995/main.htm

Kindly let us know if this helps.

Best Regards,
Jeba.

anon
Replied On April 5, 2007 01:59 PM UTC

Hi Jeba,

The code you provided works as indicated. Thank you for your assistance with this issue.

I have one further question which is related to the first issue. When modifying a record so that it triggers a sort, and then clicking to another record, the grid.Engine.ResetTable() method will be invoked. Currently, the record to be selected after the resort will be different from the one which was clicked before the sort; it will be the record at the index which was clicked and not the actual record. Is there a way to ensure that the record which was selected before the sort maintains the selection after the sort, instead of selecting the record which moved to its pre-sort index?

Please let me know if you have any additional details on this request.

Thanks again for your assistance.

>Hi John,

Sorry for the delay.

Issue 1:
You can avoid the multiple selection issue using this code snippet:

if ((e.Action == SelectedRecordsChangedType.Added) && (e.Table.SelectedRecords.Count == 1))
{
e.Cancel=true;
}


Issue 2:
You can trigger the sort using the code snippet:

this.grdPrimary.Engine.ResetTable();


Here is the modified sample:
http://websamples.syncfusion.com/samples/Grid.Windows/F57995/main.htm

Kindly let us know if this helps.

Best Regards,
Jeba.

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

;