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
   Easily Showing and Hiding Tabs at Runtime in Infor CRM (Saleslogix)
Showing and hiding tabs in the Infor CRM (Saleslogix) client should be an easy thing. It should be someth
Posted on Dec 16, 2014 by Ryan Farley to Ryan Farley's Blog
 
   Problem setting SLXTextbox enabled property / Setting unexposed base control properties for a custom control
I recently had an issue with a Quickform where I was attempting to set the Enabled property of a TextBox
Posted on Dec 05, 2014 by Jason Buss to Jason Buss' Blog
 
   Checking Infor CRM (Saleslogix) Picklists for valid data
This week I received a question about a particular picklist. One of the picklist items, when chosen, wou
Posted on Dec 05, 2014 by Dale Richter to Infor CRM Questions & Answers
 
   Avoiding the Dirty Data Message When Programatically Redirecting to a Record in Infor CRM (Saleslogix)
In my last post I wrote about using the OnClientClick property of a control (or button) to run JavaScript
Posted on Dec 02, 2014 by Ryan Farley to Ryan Farley's Blog
 
   Infor CRM (formerly Saleslogix) Web- Dependency Lookup OnChange Event Not Working Correctly
In the Saleslogix 8.1 web client the dependency lookup still has a problem with the OnChange event. 
Posted on Nov 26, 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