11-11-2011 04:03 AM
I'm trying to sort the Account Opportunities tab by Actual Close Date which I have added within the layout.
I thought I would be able to update this within the form/grid/column properties but that does not appear to be the case from my testing.
Will this require a code update to the AccountOpportunties for me to achieve this?
Any help would be greatly appreciated!
Solved! Go to Solution.
11-22-2011 05:04 AM
I added the line of code to the Load Actions - Code Snippet Action Item on the AccountOpportunities form as attached but when I go to build the web platform is fails with the below errors. Have I missed something out here? Any help would be appreciated.
ERROR -C:\Users\Administrator\AppData\Roaming\Sage\Platform\Output\Sage.SnippetLibrary.CSharp\src\Sage.SnippetLibrary.CSharp.@.de14220f-5d7f-41c1-b833-bccf7ce76ed1.codesnippet.cs(41,4):The name 'grdOpportunities' does not exist in the current context
ERROR - C:\Users\Administrator\AppData\Roaming\Sage\Platform\Output\Sage.SnippetLibrary.CSharp\src\Sage.SnippetLibrary.CSharp.@.de14220f-5d7f-41c1-b833-bccf7ce76ed1.codesnippet.cs(41,41):The name 'SortDirection' does not exist in the current context
11-22-2011 06:04 AM - edited 11-22-2011 06:12 AM
The C# Snippet Action Item (Obsolete) is not obsolete. It will be renamed in Sawgrass.
However, for a Code Snippet Action Item you need to use the following in the load action:
System.Web.UI.WebControls.GridView grid = (System.Web.UI.WebControls.GridView)form.grdOpportunities.NativeControl; grid.Sort("ActualClose", SortDirection.Descending);
01-25-2012 07:57 AM
Good stuff, thanks guys. Now how do you sort on TWO or more columns......specifically
grdAccountContacts....Status , LastName
does the sort field need to be in the grid itself, or is it always a property of the entity itself?
01-25-2012 09:50 AM - edited 01-25-2012 09:54 AM
The sort is based on the Entity properties.
Use a HQL Data Source. Select all the properties that you want to sort by even if you aren't going to display them in the grid. Also include the entity ids if you plan to link to them from the grid.