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. Image for the cookie policy date

Some Column dont appear to be sortable within Datagrid

 I've got a datagrid which is populated and allows the grid to be user selected for sorting on specific columns however some columns don't seem to be sortable despite setting the grid . column to allow sorting.

         SfDgCheckin.Columns.Clear()
        SfDgCheckin.Columns.Add(New GridTextColumn() With {.MappingName = "ID", .HeaderText = "ID", .AllowEditing = False})
        SfDgCheckin.Columns.Add(New GridButtonColumn() With {.HeaderText = "", .MappingName = "", .DefaultButtonText = "...", .NullDisplayText = "..."})
        SfDgCheckin.Columns(1).HeaderText = ""
        SfDgCheckin.Columns.Add(New GridCheckBoxColumn() With {.MappingName = "Checkin", .HeaderText = "Checkin", .TrueValue = True, .FalseValue = False, .AllowThreeState = False, .AllowEditing = True})
        SfDgCheckin.Columns.Add(New GridTextColumn() With {.MappingName = "CheckinString", .HeaderText = " ", .AllowEditing = False})
        SfDgCheckin.Columns.Add(New GridTextColumn() With {.MappingName = "GroupID", .HeaderText = "Group", .AllowEditing = True})
        SfDgCheckin.Columns.Add(New GridTextColumn() With {.MappingName = "Name", .HeaderText = "Name", .AllowEditing = True})
        SfDgCheckin.Columns.Add(New GridTextColumn() With {.MappingName = "CertificateName", .HeaderText = "Certificate Name", .AllowEditing = True})
        SfDgCheckin.Columns.Add(New GridCheckBoxColumn() With {.MappingName = "Altitude10k", .HeaderText = "10k", .TrueValue = True, .FalseValue = False, .AllowThreeState = False, .AllowEditing = True})
        SfDgCheckin.Columns.Add(New GridComboBoxColumn() With {.MappingName = "VideoOption", .HeaderText = "Video Option", .DataSource = _videoOptions, .DisplayMember = "Value", .ValueMember = "Key", .AllowEditing = True})
        SfDgCheckin.Columns.Add(New GridComboBoxColumn() With {.MappingName = "RequestInstructor", .HeaderText = "Req. Inst.", .DataSource = _Instructors, .DisplayMember = "Name", .ValueMember = "Id", .AllowEditing = True})
        SfDgCheckin.Columns.Add(New GridComboBoxColumn() With {.MappingName = "RequestLoad", .HeaderText = "Req. Load.", .DataSource = _LoadRequest, .DisplayMember = "Value", .ValueMember = "Key"})
        SfDgCheckin.Columns.Add(New GridComboBoxColumn() With {.MappingName = "CompletePPWStatus", .HeaderText = "PPW Status.", .DataSource = _PPWStatus, .DisplayMember = "Value", .ValueMember = "Key"})
        SfDgCheckin.Columns.Add(New GridTextColumn() With {.MappingName = "CompleteString", .HeaderText = "PPW Status", .AllowEditing = False})
        SfDgCheckin.Columns.Add(New GridTextColumn() With {.MappingName = "Notes", .HeaderText = "Notes", .AllowEditing = True})
        SfDgCheckin.Columns.Add(New GridTextColumn() With {.MappingName = "TandemRSNotes", .HeaderText = "RS Notes", .AllowEditing = False, .AllowResizing = True})
        SfDgCheckin.Columns.Add(New GridTextColumn() With {.MappingName = "TandemRSId", .HeaderText = "RSID", .AllowEditing = False})
        SfDgCheckin.Columns.Add(New GridCheckBoxColumn() With {.MappingName = "Deleted", .HeaderText = "Deleted", .TrueValue = True, .FalseValue = False, .AllowThreeState = False, .AllowEditing = True})


        SfDgCheckin.AllowSorting = False
        SfDgCheckin.Columns("ID").AllowSorting = True
        SfDgCheckin.Columns("TandemRSId").AllowSorting = True
        SfDgCheckin.Columns("Name").AllowSorting = True
        SfDgCheckin.Columns("GroupID").AllowSorting = True
        SfDgCheckin.Columns("CompletePPWStatus").AllowSorting = True
        SfDgCheckin.Columns("CompleteString").AllowSorting = True

When the datagrid is populated if I select ID or TandemRSID columns nothing happens - no sort or anything.   If I click on Name, GroupID or other fields then the column sort order is alternating between Ascending/Descending.

I have a repro scenario in a project which I can send - PM me for details.


7 Replies

SS Susmitha Sundar Syncfusion Team January 24, 2020 10:36 AM UTC

Hi Spotty,     
     
Thanks for using Syncfusion controls.     
     
We have checked the reported issue and we are unable to replicate the issue from our end. Sorting works fine from our end for all the columns. We have prepared a sample for your reference.     
     
   
We have tested with Syncfusion version 17.4.0.39.     
     
Please check the above sample and revert us if you are still facing the same issue? If yes, please modify the sample based on your scenario and revert us with your Syncfusion updated version.    
   
It will be helpful for us to check on it and provide you the solution at the earliest.       
     
Regards,  
Susmitha S  



SP Spotty January 24, 2020 12:40 PM UTC

I cannot access the sample but I did some more investigation on my problem datagrid.

I added another one from the toolbox and populate it in the same way and set the datasource.    The new datagrid allowed each of the columns to be sortable when the columns were auto generated.

So I then Change the code to specifically map the columns I want.

  SfDataGrid1.AutoGenerateColumns = False
        SfDataGrid1.SelectionMode = GridSelectionMode.Extended
        SfDataGrid1.Columns.Clear()
        SfDataGrid1.Columns.Add(New GridTextColumn() With {.MappingName = "ID", .HeaderText = "ID", .AllowEditing = False})
        SfDataGrid1.Columns.Add(New GridTextColumn() With {.MappingName = "GroupID", .HeaderText = "GroupID", .AllowEditing = False})
        SfDataGrid1.Columns.Add(New GridTextColumn() With {.MappingName = "Name", .HeaderText = "Name", .AllowEditing = True})


With these being used to format the grid - the ID column is not sortable and yet the GroupID and Name columns are sortable.

I reiterate that this is a new datagrid added from toolbox (not copied) and that the datasource is set from

  SfDataGrid1.DataSource = _ClassReservationData

with _ClassReservationData being a POCO class of ObservableCollection(Of Reservation)  with the following

Public Class Reservation
   
    Public Property Id() As Integer
    Public Property ReservationDate() As Date?
    Public Property ReservationClass() As Integer
    Public Property Name() As String
    Public Property CertificateName() As String
    Public Property GroupID() As String
End Class


Furthermore if I comment out the line 

SfDataGrid1.AutoGenerateColumns = False

SO that I have my columns and the autogenerated ones added.   The ID column I added does not sort, yet the autogenerated one does.



SP Spotty January 24, 2020 12:45 PM UTC

Eventually figured out that the mapping name is case sensitive, when I noticed the columns ID and Id

Changed to match case and the sorting worked.

Strange that the data was brought in correctly but the sort didnt work.   That seems like a bug - it would have made things more obvious if the data didnt display.


SS Susmitha Sundar Syncfusion Team January 27, 2020 12:56 PM UTC

  
Thank you for your update.  
  
We can able to reproduce your reported issue and created the bug report for the same. Can you please specify your current Syncfusion version so that We will provide a patch for that version?  
   
Regards,  
Susmitha S  



SP Spotty January 27, 2020 07:09 PM UTC

The latest version which is available for download.   I had just reinstalled my development machine with clean install.


SS Susmitha Sundar Syncfusion Team January 28, 2020 12:37 PM UTC

Hi Spotty, 
 
We have our latest version of Volume 4, 2019(17.4.0.39) release. If you install this version, we will provide the patch for that version. Can you please confirm this? 
 
 
Regards, 
Susmitha S 



VS Vijayarasan Sivanandham Syncfusion Team March 19, 2020 02:25 PM UTC

Hi Spotty,

We are glad to announce that our Essential Studio 2020 Volume 1 Beta Release version 18.1.0.36 is rolled out with the reported bug fix “MappingName and PropertyName of the column are case-insensitive, data will populated.” and is available for download under the following link.

https://www.syncfusion.com/forums/152560/essential-studio-2020-volume-1-beta-release-v18-1-0-36-is-available-for-download

We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.

Regards,
Vijayarasan S
 


Loader.
Live Chat Icon For mobile
Up arrow icon