Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Tuesday, November 26, 2024 
 
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: How do I get the selected row in a DataGrid?
Stuart
Posts: 178
 
How do I get the selected row in a DataGrid?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Nov 06 8:47 AM
fiogf49gjkf0d
I have a form with a Browser control on the left, and a DataGrid on the right. I have managed to populate the DataGrid, but what I want to do is change the contents of the Browser control according to the selected row in the DataGrid. I thought that OnRowSelect would be the logical event to trap, but it seems that it never fires.

I did notice that the drop-down in the properties window for the DataGrid.OnRowSelect event does not list my Sub either, I had to type it in, so maybe that is relevent?

I checked things were generally working by putting diagnostic code in OnMouseUp, and that fires OK, but doesn't give me enough to figure out which row (if any) is selected.

Anyone help please, getting OnRowSelect to work, or some other way of getting the selected row from the datagrid (whether left mouse clicked, or by keyboard up/down arrow)? I think I must be missing something fundamental here.

[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: How do I get the selected row in a DataGrid?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Nov 06 1:30 PM
fiogf49gjkf0d
If multi-select = true, use Grid.Selection.Item(0) but only if you've added the primary key as the first column and marked it hidden.
If multi-select = false, use Grid.GetCurrentField("") which works with or without the primary key included in the grid.

OnRowSelect works but I believe it only happens when you click on the row. It does not work if you have checkboxes on and click a checkbox for a particular row. I believe there are other instances where it doesn't fire for sure, but I've tested anything else.
[Reply][Quote]
Stuart
Posts: 178
 
Re: How do I get the selected row in a DataGrid?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Nov 06 3:02 AM
fiogf49gjkf0d
Quote:
Originally posted by Jeremy Brayton

If multi-select = true, use Grid.Selection.Item(0) but only if you've added the primary key as the first column and marked it hidden.
If multi-select = false, use Grid.GetCurrentField("") which works with or without the primary key included in the grid.


Thanks, that is very helpful, but...

Quote:

OnRowSelect works but I believe it only happens when you click on the row. It does not work if you have checkboxes on and click a checkbox for a particular row. I believe there are other instances where it doesn't fire for sure, but I've tested anything else.

I don't have any checkboxes, just columns of data, so it must be one of the other instances stopping it from working, I will have to experiment. Once I can get an event to fire I can get the data I need, but I'm a bit stuck at the moment.
[Reply][Quote]
Ben
Posts: 4
 
Re: How do I get the selected row in a DataGrid?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Nov 06 7:13 AM
fiogf49gjkf0d
[edit:double-post]
[Reply][Quote]
Ben
Posts: 4
 
Re: How do I get the selected row in a DataGrid?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Nov 06 7:13 AM
fiogf49gjkf0d
if your subroutine does not show up as an available option in the event list, then your sub does not accept the necessary number of arguments. different events have different signatures.
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: How do I get the selected row in a DataGrid?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Nov 06 9:24 AM
fiogf49gjkf0d
I would second what Ben mentioned. Your real problem here is that the OnRowSelect is not firing. If your function event handler is not showing in the drop down for the event, then the function does not have the right signature - meaning that the function's parameter list doesn't match what that handler is supposed to look like.

Do this in Architect:

1) Select the grid in Architect and go to the events tab
2) Delete whatever text is in the OnRowSelect event and then click somewhere else to get focus out of the event list after removing the text
3) Double-click the now empty area for the OnRowSelect event where the text was before. This will create a new empty stub for the event with the correct parameter list. Move your code to this stub.

-Ryan
[Reply][Quote]
Stuart
Posts: 178
 
Re: How do I get the selected row in a DataGrid?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Nov 06 9:29 AM
fiogf49gjkf0d
Thanks Ben and Ryan - that was the vital piece of information I was missing!

[Reply][Quote]
Stuart
Posts: 178
 
Re: How do I get the selected row in a DataGrid?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 Nov 06 8:53 AM
fiogf49gjkf0d
Hmm. Now I can bind my code to the event properly, but it still doesn't fire. I put a MsgBox at the start of my Sub, and it never happens. If I move the code to the OnMouseUp handler it works fine, and is almost what I want, but not quite (the Browser control isn't populated when the form loads) and it doesn't feel right.

Very strange
[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 © 2024 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): 11/26/2024 10:56:22 PM