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
   Error Attempting to Save an Entity: "E_FAIL(0x80004005)" in the Infor CRM (Saleslogix) Web Client
We recently had a client that was running into an issue when attempting to create one particular entity i
Posted on Sep 30, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
   Video: Demystifying Infor CRM (Saleslogix) Updates
Watch it now! If you missed yesterdays demo, "Demystifying Infor CRM (Saleslogix) Updates" ,
Posted on Sep 26, 2014 by Brianna Ojard to The Inbox
 
   Official Infor CRM Acquisition FAQ
What to expect now that Saleslogix is Infor CRM. Like many of you, it will take some time (probably a
Posted on Sep 18, 2014 by Brianna Ojard to The Inbox
 
   Problem with the Clean Build Folders option in Application Architect
On occasion, it becomes necessary to clean out the build folders and deployed website prior to a build/de
Posted on Sep 16, 2014 by Jason Buss to Jason Buss' Blog
 
   Restricting Adding Opportunity Contacts to Contacts at the Opportunity's Account
 One thing that clients have asked for is how to restrict the selection of the Opportunity Contacts
Posted on Sep 09, 2014 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 © 2014 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