Login / Register  search  syndication  about

          Ryan Farley's Blog

Ryan Farley on .NET Development with a focus on CRM Development for SalesLogix

Setting the Default Sort for a DataGrid in SalesLogix Web

SalesLogix Web comes with it's own set of controls to be used on QuickForms. These controls are still in their infancy and will likely grow over time, but for now, there are some things missing that might be perceived as limitations. It's helpful to know more about what is under the hood of these OOTB QuickForm controls so you can easily work around limitations and push the controls to behave the way you want them to work.

The DataGrid control in the SalesLogix Web architecture is a very simple control. There's not a lot of “extras” to it at all. One common thing that might be desired with the DataGrid is to specify an initial sort order for it's data. Looking at the properties for the grid in the QuickForms editor, you won't see a way to specify this. However, let's take a look under the hood at the grid control.

The SalesLogix QuickForm controls are located in the assembly named “Sage.SalesLogix.Web.Controls.dll”. If you look at a SmartPart with a grid on it you'll notice that the grid control is actually called “SlxGridView“. If we open that DLL in reflector and navigate to located SlxGridView we can see the following:

Well cool. It inherits from the standard ASP.NET GridView control. We can take a look at the MSDN docs for the GridView control and see all that it contains. Since the SlxGridView control inherits from System.Web.UI.WebControls.GridView, it has everything that we see listed there, including a Sort method.  

We can take what we've learned there and just add some code to a LoadAction for our QuickForm to set the default/initial sort order for the grid. The Sort method takes two parameters. The field or property name to sort by (you can specify multiple properties/fields here, delimited by a comma) and the second parameter indicates the sort direction. I added some code to the LoadAction of the AccountTickets QuickForm to sort the ticket's in descending order by the ReceivedDate property of the Ticket entities listed in the grid.

grdAccountTickets.Sort("ReceivedDate", SortDirection.Descending);

That is it. While the SalesLogix DataGrid control itself didn't have anything built in for specifying a sort programatically, knowing where to look makes this an easy task because we get to see what else it has from it's base type.

What's This?
  
Bookmark and Share

About Ryan Farley

   Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix since 2001 and believes in sharing with the community. He loves C#, Javascript, Python, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

View the SalesLogix Mobile Seveloper Series
View the SalesLogix SData Developer Series
View the Git for the SalesLogix Developer series



Related Content
   Can I Bind an Attachment to a Specific Activity in Infor CRM version 7.54?
Recently I had a user ask if they could bind an attachment to a specific Activity within Infor CRM??
Posted on Jul 07, 2015 by Dale Richter to Infor CRM Questions & Answers
 
   Infor CRM (Formerly Saleslogix) Iterating through all tabs on a Page
 Using the TabWorskpace you can iterate through all the tabs on a page and do something with them, l
Posted on Jun 19, 2015 by Kris Halsrud to Kris Halsrud's Blog
 
   Infor CRM (Formerly Saleslogix) Hiding Tabs at Runtime Without Using Modules
 As Ryan wrote a long time ago, you can create a module and add it to a page in the Infor CRM web cl
Posted on Jun 10, 2015 by Kris Halsrud to Kris Halsrud's Blog
 
   How I assign ownership to a group of Leads in Infor CRM?
There is a tool within Infor CRM to align Accounts to different Account Owners. It is called Territory Re
Posted on Jun 05, 2015 by Dale Richter to Infor CRM Questions & Answers
 
   Infor CRM (Formerly Saleslogix) Adding a Client Side Confirmation on a Dependency Lookup in the Web Client
 We recently had a client who wanted to have a user confirmation prompt before a user was allowed to
Posted on May 28, 2015 by Kris Halsrud to Kris Halsrud's Blog
 
Comments

 

CRM Developer said:

A while back I wrote an article on setting the sort for a DataGrid in SalesLogix Web at runtime. That solution worked great in SalesLogix 7.2. However, things changed in SalesLogix 7.5 so I thought it was time for an update to that original post. Let's

March 26, 2009 5:16 PM
 

Aleks said:

Hi All, I'm just trying to sort a datagrid by a couple of properties

grid.Sort("col1,col2", SortDirection.Descending);

delimited by commas, but I'm getting this error:

DataBinding: 'Sage.Platform.ComponentModel.ComponentView' does not contain a property with the name 'Col1,Col2'.

It works fine using only one property.

Any ideas? thanks in advance

October 14, 2010 10:50 AM

Leave a Comment

(required)  
(optional)
(required)  
Add
All contents Copyright © 2015 Customer FX Corporation
Customer FX Corporation
2324 University Avenue West, Suite 115
Saint Paul, Minnesota 55114
Tel: 800.728.5783

  Follow @CustomerFX on twitter
Follow the best news, tips, and articles
  Subscribe to Customer FX on youtube
Watch SalesLogix tutorial videos from Customer FX
Login / Register