Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, November 29, 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 - Controls
Forum to discuss usage & tips for SalesLogix controls and other 3rd party ActiveX controls. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to Controls | New ThreadView:  Search:  
 Author  Thread: Datagrid - set focus on row
Jennifer
Posts: 2
 
Datagrid - set focus on rowYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 14 Dec 07 9:45 AM
Hi all,

I have a datagrid that is being populated by a large amount of records. When the user deletes a selected amount of rows, I want to set focus on the row previous to his selection. How can I do this?

Thanks!
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Datagrid - set focus on rowYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 14 Dec 07 10:36 AM
First of all, this works well in newer versions of SLX, but the earlier versions (maybe earlier than 6.2.4) of the datagrid you didn't have the ability to select a row. What version is this for?

To do this, you'll need to determine the ID value of the row you'd like to select after the delete occurs. The best way I can think of off top of my head is to take the grid's recordset, loop though it until you find the selected row, and then use the value from the row right before it. Once you have the ID value you can proceed with the delete.

After the delete, you'll select the row by adding the ID value from the row you determined was the row you wanted to select to the grid's Selection collection.

DataGrid1.Selection.Add id


Make sense? For the Selection collection to work at all (to read the selected rows or set them) you'll need to add the ID field for the table to the grid (and then hide it).

-Ryan
[Reply][Quote]
Jennifer
Posts: 2
 
Re: Datagrid - set focus on rowYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 14 Dec 07 10:45 AM
Hi Ryan,

I had noticed that in newer releases this would be easier. I'm unfortunately stuck with 6.x.

I actually already have IDs (hidden values) in the grid, so I can loop through and find what ID it is previous to the selection I delete. What function do I use to setfocus?
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Datagrid - set focus on rowYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 14 Dec 07 12:52 PM
Adding the ID values to the grid's Selection collection is what "selects" them. Depending on what version of 6.x you're on, you might or might not even have a Selection collection for your grid (if it doesn't show up in the intellisense then you're SOL - there was no way to programatically select rows in early versions)
[Reply][Quote]
Rob Bartram
Posts: 98
 
Re: Datagrid - set focus on rowYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Jun 08 9:50 AM
Hello, I'm running SLX 7.2.2 and when programatically selecting a the row using the method described, if the newly selected record is not showing (outside scroll range) the grid is not auto-scrolling to that record. Any thoughts?

...Rob
[Reply][Quote]
Rob Bartram
Posts: 98
 
Re: Datagrid - set focus on rowYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Jun 08 9:50 AM
Hello, I'm running SLX 7.2.2 and when programatically selecting a the row using the method described, if the newly selected record is not showing (outside scroll range) the grid is not auto-scrolling to that record. Any thoughts?

...Rob
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Datagrid - set focus on rowYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Jun 08 10:35 AM
Hi Rob. IIRC, that is a long standing bug with the SLX grid control.
[Reply][Quote]
Rob Bartram
Posts: 98
 
Re: Datagrid - set focus on rowYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 Jun 08 7:40 AM
Thanks.
[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/29/2024 11:36:26 PM