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.

Selection after Sorting is unstable

Thread ID:

Created:

Updated:

Platform:

Replies:

117399 Oct 13,2014 08:00 AM Nov 14,2014 09:21 AM Windows Forms 3
loading
Tags: GridGroupingControl
Tanmaya Mohanty
Asked On October 13, 2014 08:00 AM

Hi,

I have implemented GridGroupingControl. 

my first column is holding checkboxes to select rows. This selection of rows works properly but when i sort the header and try selecting, rows moves up and down and also selection does not happen properly. 

Any help will be highly appreciated.

Thanks,
Tanmaya

Muthukumar Kalyanasundaram [Syncfusion]
Replied On October 17, 2014 12:15 AM

Hi Tanmaya,

Thank you for your interest in Syncfusion products.

If you want to select the checkbox and sort the record based on order, you can use the “TableControlCheckBoxClick” event. By this event, you can set the “GetRecord” method. Please refer the below code,

Code:

this.gridGroupingControl1.TableControlCheckBoxClick += new Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCellClickEventHandler(gridGroupingControl1_TableControlCheckBoxClick);

void gridGroupingControl1_TableControlCheckBoxClick(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCellClickEventArgs e)

        {

            GridTableCellStyleInfo style = (GridTableCellStyleInfo)e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex);

            Record r = style.TableCellIdentity.DisplayElement.GetRecord();

            int index = e.TableControl.Table.DisplayElements.IndexOf(r);

            this.gridGroupingControl1.TableControl.CurrentCell.EndEdit();

            string val = r.GetValue("Add Item").ToString();

        }

Please let us know if you have any concern.

Regards,

Muthukumar K


Attachment: Sorting_9c4d421e.zip

Tanmaya Mohanty
Replied On November 12, 2014 05:53 AM

Hi,

Thanks for your suggestion. unfortunately it does not resolve my issue. This seems to be a syncfusion issue. when the checkbox column is sorted and then you try selecting randomly it does not select the proper item which you intend to select.

I tried with a different approach with custom sorting for the column. Using custom sorting i could sort the particualr column, but coresponding other columns are not getting sorted. I seek your help in this.

Sample code attached.

Thanks,
Tanmaya

Attachment: Sorting_ff082aca.rar

Muthukumar Kalyanasundaram [Syncfusion]
Replied On November 14, 2014 09:21 AM

Hi Tanmaya,

 

Thanks for the update.

 

If you want to sort  particular column you can use ”TableControlQueryAllowSortColumn” event and remaining columns are disabled the sorting operation. We have modified your attached sample. Please refer to it.

 

Code:

 

this.gridGroupingControl1.TableControlQueryAllowSortColumn += new Syncfusion.Windows.Forms.Grid.Grouping.GridQueryAllowSortColumnEventHandler(gridGroupingControl1_TableControlQueryAllowSortColumn);

 

void gridGroupingControl1_TableControlQueryAllowSortColumn(object sender, GridQueryAllowSortColumnEventArgs e)

  {

   if (e.Column.Name == "Add Item")

     e.AllowSort = true;

   else

                e.AllowSort = false;

  }

 

Please let us know if you have any concern.

 

Regards,

Muthukumar K


Attachment: Sorting_5521fdf2.zip

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.

;