StrataFrame Forum

Sorting problem with ListView

http://forum.strataframe.net/Topic23508.aspx

By Doron Farber - 6/15/2009

Hi Trent,

I am using code like the below in the Load event to sort the first column of the ListView:
Me.dSearchCategoriesBO1.Sort = "DisplayOptionOrder"

But that is causing a problem when I click the Add button within that ListView. It comes as an Edit mode and shows me the current record in the ListView. I cancelled that and click again the Add button and then it works fine. The work around this problem was when I entered the following within this event: lstSearchCategories_BeforeChildFormExecuted as this one:
If e.Action = MicroFour.StrataFrame.UI.ListViewChildFormAction.Add Then
Me.GrandChildSearchCategoriesBO1.Sort = ""

End If

End Sub



Then in the ListView ChildFormResults event I entered this code:
Me.dSearchCategoriesBO1.Sort = "DisplayOptionOrder"


 


 

 

By Doron Farber - 6/15/2009

Hi Trent,

Ignore the prev Thread, went out too early.Smile

I am using code like the below in the Load event to sort the first column of the ListView:
Me.dSearchCategoriesBO1.Sort = "DisplayOptionOrder"

But that is causing a problem when I click the Add button within that ListView. It comes as an Edit mode and shows me the current record in the ListView. I cancelled that and click again the Add button and then it works fine. The work around this problem was when I entered the following within this event: lstSearchCategories_BeforeChildFormExecuted as this one:

If e.Action = MicroFour.StrataFrame.UI.ListViewChildFormAction.Add Then
 Me.GrandChildSearchCategoriesBO1.Sort = ""
End If

Then in the ListView ChildFormResults event I entered this code:
Me.dSearchCategoriesBO1.Sort = "DisplayOptionOrder"

The original sorting is in a different field and that's why I used the BO.Sort
Is there someting that needs to be improved somewhere?


Regards,

Doron

By Trent L. Taylor - 6/15/2009

It is always dangerous setting the Sort on and off like that when you are adding records. You can find all types of posts out here about that sort of thing. Just turn on the sort while populating the list and then turn it off in the AfterRequery. When you leave a sort on a BO then add records, you are going to have issues. I know without digging to hard that your issue is going to be related to the sort of the BO somehow.