IListServer implementation for DevExpress Server Mode


Author
Message
Andria Jensen
Andria Jensen
StrataFrame User (392 reputation)StrataFrame User (392 reputation)StrataFrame User (392 reputation)StrataFrame User (392 reputation)StrataFrame User (392 reputation)StrataFrame User (392 reputation)StrataFrame User (392 reputation)StrataFrame User (392 reputation)StrataFrame User (392 reputation)
Group: Forum Members
Posts: 336, Visits: 497
Do you guys implement IListServer for the BOs and if not, can you point me in the right direction of how to implement this myself?  We are are generating a few really large datasets and it is taking a while to render them without having this implemented.  Thanks!
Replies
Andria Jensen
Andria Jensen
StrataFrame User (392 reputation)StrataFrame User (392 reputation)StrataFrame User (392 reputation)StrataFrame User (392 reputation)StrataFrame User (392 reputation)StrataFrame User (392 reputation)StrataFrame User (392 reputation)StrataFrame User (392 reputation)StrataFrame User (392 reputation)
Group: Forum Members
Posts: 336, Visits: 497
Ok, here we go...I'm getting somewhere with all of this.  Just implementing these two gets the data returning back correctly.  However, there are still a bunch of others to implement grouping, sorting, etc. 

Public Function GetRowIndexByKey(ByVal key As Object) As Integer Implements DevExpress.Data.IListServer.GetRowIndexByKey
  Return Me.BusinessObject.CurrentView.Find(key)
End Function

Public Function GetRowKey(ByVal index As Integer) As Object Implements DevExpress.Data.IListServer.GetRowKey
  Return Me.BusinessObject.CurrentDataTable.Rows(index).Item(Me.BusinessObject.PrimaryKeyField)
End Function


This is what I am using for sorting and it is working, but NOT for custom properties.  How do you do a sort in code for the custom property or can you???  I know the BBS handles this for you, but not sure how to do it myself.  Any suggestions?

Public Sub ApplySort(ByVal sortInfo As System.ComponentModel.ListSortDescriptionCollection, ByVal groupCount As Integer, ByVal summaryInfo As System.Collections.Generic.List(Of DevExpress.Data.ListSourceSummaryItem), ByVal totalSummaryInfo As System.Collections.Generic.List(Of DevExpress.Data.ListSourceSummaryItem)) Implements DevExpress.Data.IListServer.ApplySort

 
If sortInfo IsNot Nothing Then

   
Dim sortString As String = ""

   
For Each info As ListSortDescription In sortInfo
     
sortString &= info.PropertyDescriptor.Name & " " & IIf(info.SortDirection = ListSortDirection.Ascending, "ASC, ", "DESC, ")
    Next

   
Me.BusinessObject.Sort = sortString.TrimEnd(",", " ")

  End
If

End Sub


Trent Taylor
Trent Taylor
StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
How do you do a sort in code for the custom property or can you???




This logic will be entirely up to how you handle the code behind the custom property. Back to basics first, a BO.Sort uses the CurrentView.Sort property. So the sort is ultimately handled in the ADO.NET table behind the BO.



Depending on how you are sorting, then you can either force a column into the CurrentDataTable for sorting purposes, or if there is an IComparer option, you can do anything you want. This would allow you to pull the logic out of the standard BO sort. I don't have any first hand experience with the IListServer interface, but the IBindingList implementation may be a similar comparison in regards to the Sort implementation. In this case, in a BBS, we rely on the sort of the BO, not recreating an internal sort.



Don't know if any of this helps, but this isn't an easy to answer question because there are a lot of factors that can be involved.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search