Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Wednesday, June 18, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Select Row in datagrid
Nick McLean
Posts: 50
 
Select Row in datagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 Jun 07 5:36 AM
Hi Folks,

Bit of background needed for this. I am using SLX v7 sp1 - Client did not like the fact that icons were no longer on the attachments tab, so I added a new column to the grid using a view to show the file extension (which in the absense of an icon will do fine).

However whenever a user visits the attachments tab, the selected row is always the last one in the grid, it would be nicer if it were the first one in the grid - any ideas how I could do this?

Kind Regards

Nick
[Reply][Quote]
Nick McLean
Posts: 50
 
Re: Select Row in datagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 Jun 07 7:43 AM
Ah well - I managed to sort it, by adding createdate and sorting desc by it.

If anyone has got a scripty way to move to the first record in a datagrid I would be appreciative

I tried

grdattach.nodes.index(0).selected = true

grdattach.recordset.movefirst

among others but nothing seemed to do it.

Anyway as the problem is fixed its not really high priority now

Cheers

Nick
[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: Select Row in datagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 Jun 07 1:52 PM
I had a technique I thought was viable through code but it turns out my logic was all wrong. I set a separate recordset object and used MoveLAST, thinking that doing this would just reverse the existing sort. I would then capture the attachid, clear the .selection collection and add the single record back.

That process is sound but the problem is MoveLast or even MoveFirst wouldn't go to the first record. This is because the default sort (none applied) is against attachid at the SQL level. When sortable = true, sorting is applied at the CONTROL level and doesn't even touch SQL. I believe this to be a defect but it's kind of hard to believe this wasn't caught before SP1 considering it affects EVERY GRID, not just Attachments.

A nice alternative I've been using since 6.1 is the GroupPanel. It creates a section of the grid where users can drag columns and create sort chains. It can also be manipulated programmatically. All of this without sortable = true mind you (and fully functional). In light of this "defect", there is absolutely NO benefit of using sortable = true. The funny thing is, it's like sortable = true and GroupPanel create parallel universes for the grid where one behavior does not equal the other in any way. GroupPanel sorts SQL and thus the control behaves wonderfully. Sortable manipulates the control itself, and creates a gaping disconnect between the control and SQL.

I'll prove it with this point: The only conceiveable way of making my example work with every grid is to first iterate the columns collection to determine what column is being sorted at runtime. Then I would have to somehow make the underlying recordset sort by this column, or used some internal function like GetLast/GetFirstValue that would only capture the greatest or least value as I iterate through every record in the recordset. None of this is sounding fun to me at this point. The good news is I may be way off base and there's some simple function that makes the grid behave as I expect it. Ultimately it looks like I'll just bite the bullet and deal with GroupPanel. It'll create an update nightmare to make sure my attachment forms are in sync with Sage's but apparently that's what I'll have to do until something changes, on their end.
[Reply][Quote]
Nick McLean
Posts: 50
 
Re: Select Row in datagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 26 Jun 07 3:43 AM
Thanks Jeremy,

Smashing post - I knew I liked GroupPanel in terms of the functionality that it gave the end user, but you have described to me a good practical reason for liking it too.

I didn't realise that that was the way sortable worked, I think I will try to give it a miss in the future.

Kind Regards

Nick
[Reply][Quote]
Bob (RJ)Ledger
Posts: 1103
Top 10 forum poster: 1103 posts
 
Re: Select Row in datagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 26 Jun 07 6:31 AM
FYI - Even in 7.2 you will not see icons.

When the Attachment grid(s) was hard-coded it was "easy" to provide an icon. It just takes too much VBScript, etc and a performance hit to do it in script.

Now if you really want icons then ask Sage to "re-hard-code" the attachment grid(s).

--
rjl
[Reply][Quote]
Nick McLean
Posts: 50
 
Re: Select Row in datagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 26 Jun 07 9:41 AM
Have to say that it had a pretty drastic hit on MY performance as I tried to put the icons back in.

Was glad when I managed to persuade the customer that having file extensions as the first column was just as good!

I can think of other things for Sage to focus on that would be more worthwhile so I think I will let them leave it 'soft coded' (I assume that is the opposite of hard coded?)


See Ya and Thanks

Nick
[Reply][Quote]
Steve Hurlburt
Posts: 2
 
Re: Select Row in datagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 27 Jun 07 2:00 AM
There is actually a very simple fix to selecting the first record.

First set the Sortable property on the datagrid to false. Then in the datagrids columns collection make sure the Sorted column, if set, is changed to csNone.
Lastly on the forms OnChange event add this line of code at the end grdAttach.Columns.Item("ATTACHDATE").Sorted = 1

That's it.
[Reply][Quote]
Nick McLean
Posts: 50
 
Re: Select Row in datagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 27 Jun 07 3:35 AM
Thanks Steve,

I will give that a go

Nick
[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: Select Row in datagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 27 Jun 07 8:41 AM
That works fine if you don't want the grid to be sortable for any of the other columns. When sortable = false, clicking the column headers does nothing. Unless of course by some miracle setting Sorted = 1 "jump starts" sorting, which I highly doubt. It probably wouldn't be difficult to add sorting through code and the columnclick routine without needing to load the entire recordset into the .recordset property.

The only real case for using the sortable property is if you're doing some processing against the recordset and you don't want to mess with calling the SQL by hand. I don't believe the attachment screens meet this requirement if memory serves me. One thing I haven't tried is using sortable and grouppanel together to see how the control behaves. Those of you who haven't even used grouppanel yet, try it sometime.
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 6/18/2025 11:06:04 PM