The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
From my understanding the sorting of the gridbounddatagrid is based of the dataview.sort property.
I'm looking to extend the grid so that when the user changes a value in the sorted column the row doesn't jump and get dynamically sorted.
The requirement then is to only sort when the header of the grid is clicked or double clicked and to show the sort direction arrow (current behaviour).
I've tried override the sortcolumn function performing the following:
public override void SortColumn(int colIndex) { base.SortColumn (colIndex); this.Refresh(); DataView dv = GetDataView(); dv.Sort = ""; }
Unfortunately, this not only removes the current sort but the sort arrow on the header is removed;
I essentially need the exact same behaviour as this sample but for the gridbounddatagrid.
I've explored the idea of dynamically adding an additional hidden column and keep a sort index on that column but I'd pefer to avoid this approach if there is a easier solution.
Is there an easy way to turn off the dynamic sort of the grid?
ADAdministrator Syncfusion Team November 3, 2006 04:04 AM UTC
Hi Mike,
The attached sample implements the ListWrapper class to avoid the 'jumps' while the user changes the value in a sorted column. It also support the multicolumn sorting in a grid. Please try this and let me know if this helps.
Here is a sample. http://www.syncfusion.com/Support/user/uploads/WrapperClassSortSample_46fcd2f1.zip
Best Regards, Haneef
MNMike NohrNovember 6, 2006 11:11 PM UTC
Thanks the sample works great except for one thing:
CurrencyManager cm = (CurrencyManager)this.dbgPOLines.BindingContext[this.dbgPOLines.DataSource]; DataView dv = (DataView)cm.List;
Now the currency manager cast returns the type of the ListWrapper class. Is there a way to have it cast to a dataview as it does by default?
>Hi Mike,
The attached sample implements the ListWrapper class to avoid the 'jumps' while the user changes the value in a sorted column. It also support the multicolumn sorting in a grid. Please try this and let me know if this helps.
Here is a sample. http://www.syncfusion.com/Support/user/uploads/WrapperClassSortSample_46fcd2f1.zip
Best Regards, Haneef
ADAdministrator Syncfusion Team November 7, 2006 12:19 PM UTC
Hi Mike,
There is no built-in property to get this. You can use the below code snippet to get the dataview from the ListWrapper class.
public DataView GetDataView() { PropertyDescriptorCollection tpdc = ((ITypedList)this).GetItemProperties(null);
DataTable dt = new DataTable(((ITypedList)this).GetListName(null)); for(int i =0 ;i< pdc.Count;i++) dt.Columns.Add(tpdc[i].Name,tpdc[i].PropertyType); for(int i = 0;i< this.Count;i++) { DataRowView row = this[i] as DataRowView;