I have a column(long datatype) on my grid that is Unbound and all the others are Bound. When I click on the header of the unbound column, the column reorders itself but is not sorted. On second click on header, nothing happens.
Sorting of all bound columns work perfectly.
I have not written any code for sorting except for enabling sorting behavior.
Do we have to write any additional code for sorting unbound columns?
This may help you, it may not. I had an issue with using Template Columns where if I tried sorting by these columns then it would completely clear the grid. The solution I found was to add some code behind for the CoumnSorted event:
Dim strPrevSortedColumn As String = ""
If HttpContext.Current.Session("CURRENTSORTEDCOLUMN") IsNot Nothing Then
strPrevSortedColumn = HttpContext.Current.Session("CURRENTSORTEDCOLUMN")
End If
Dim arSortColumn As Array = {"", ""}
If strPrevSortedColumn <> "" Then
arSortColumn = strPrevSortedColumn.Split(",")
If e.Column.Key.Substring(0, 2) = "tc" Then 'All of my Template Column Keys begind with tc
e.SortedColumns.Clear()
If e.Column.Key <> arSortColumn(1) OrElse arSortColumn(0) <> "Asc" Then
e.SortedColumns.Add(Me.[WebDataGridName].Columns("k" & e.Column.Key.Substring(2)), Infragistics.Web.UI.SortDirection.Ascending)
strPrevSortedColumn = "Asc"
Else
e.SortedColumns.Add(Me.[WebDataGridName].Columns("k" & e.Column.Key.Substring(2)), Infragistics.Web.UI.SortDirection.Descending)
strPrevSortedColumn = "Desc"
strPrevSortedColumn = "None"
strPrevSortedColumn &= "," & e.Column.Key
HttpContext.Current.Session("CURRENTSORTEDCOLUMN") = strPrevSortedColumn
[Sub to populate Grid]()
Thanks for your reply. Will try it out.
Hello Mariyam,
Thank you for posting on our forums.
Please let me know if the suggestion provided by Guy Curtis resolves the behavior you're encountering. If not, please let me know the type of object that you are using for your unbound column and I will investigate this behavior further.
I am looking forward to hearing from you.
Thank you for the update.
There is one fix that was made for unbound column sorting with 12.2. I recommend downloading the latest service release to take advantage of this fix in your application. To learn how to download a service release, please review the post linked below:http://es.infragistics.com/community/forums/t/29398.aspx
Please let me know if you have any questions regarding this matter.
Thanks for your sample.
I am sorry I forgot to mention that i am using 12.2 version of Infragistics. Is there any issue specific to that version.?
I am able to sort bound and unbound columns by enabling the sorting behavior in the attached sample. If this is not the behavior you are encountering in your application, may I ask if you can provide me with a sample that reproduces the behavior you are encountering in your application? This would allow me to debug the issue further and provide you with a solution.
Please review the sample and let me you know if you have any questions.
Hi,
I just want to know the behavior of sorting of Infragistics webdatagrid.
I was able to sort the bound columns(string, integers) without writing a single line of code by just enabling the sorting behavior. Why is it not the same case with unbound column? Am I missing anything?
My unbound column is a long integer.
Awaiting your reply.