Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Highlighted
Bronze Elite Contributor
Posts: 514
Registered: ‎03-24-2009
Accepted Solution

Column Sorting SLX WEB

Hi All,

 

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!

 

 

 

Regards, Adam Travers
empath-e Services Limited
Highlighted
Nickel Contributor
Posts: 56
Registered: ‎10-26-2010

Re: Column Sorting SLX WEB

Add a C# snippet load action to the form.

 

grdOpportunities.Sort("ActualClose", SortDirection.Descending);

Highlighted
Bronze Elite Contributor
Posts: 514
Registered: ‎03-24-2009

Re: Column Sorting SLX WEB

[ Edited ]

Many thanks Collin!

Regards, Adam Travers
empath-e Services Limited
Highlighted
Bronze Elite Contributor
Posts: 514
Registered: ‎03-24-2009

Re: Column Sorting SLX WEB

Hi Collin,

 

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

Regards, Adam Travers
empath-e Services Limited
Highlighted
Bronze Elite Contributor
Posts: 514
Registered: ‎03-24-2009

Re: Column Sorting SLX WEB

Just to add to my previous post. If  I use the C# Snippet Action Item (Obsolete) It builds with no errors and works fine. Smiley Sad

Regards, Adam Travers
empath-e Services Limited
Highlighted
Nickel Contributor
Posts: 56
Registered: ‎10-26-2010

Re: Column Sorting SLX WEB

[ Edited ]

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);

Highlighted
Bronze Elite Contributor
Posts: 514
Registered: ‎03-24-2009

Re: Column Sorting SLX WEB

Thats great! Many thanks Collin.

Regards, Adam Travers
empath-e Services Limited
Highlighted
Silver Contributor
Posts: 835
Registered: ‎03-24-2009

Re: Column Sorting SLX WEB

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?

 

Thanks!

RJ Samp
Highlighted
Nickel Contributor
Posts: 56
Registered: ‎10-26-2010

Re: Column Sorting SLX WEB

[ Edited ]

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.

Highlighted
Silver Contributor
Posts: 835
Registered: ‎03-24-2009

Re: Column Sorting SLX WEB

I will try HQL, thanks for the tip!

RJ Samp