11/26/2024 8:21:51 PM
|
|
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!
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.
|
|
|
|
How do I get the selected row in a DataGrid?
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.
|
|
|
|
Re: How do I get the selected row in a DataGrid?
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. |
|
|
|
Re: How do I get the selected row in a DataGrid?
Posted: 09 Nov 06 3:02 AM
|
fiogf49gjkf0d 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...
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. |
|
|
| |
|
Re: How do I get the selected row in a DataGrid?
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. |
|
|
|
Re: How do I get the selected row in a DataGrid?
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 |
|
|
| |
|
Re: How do I get the selected row in a DataGrid?
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
|
|
|
|
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!
|
|
|
|
|
|
|
|