Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, June 6, 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 - 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: Grid Control - Staying on the Same Row
Dag Anderson
Posts: 6
 
Grid Control - Staying on the Same RowYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Dec 06 5:17 PM
fiogf49gjkf0d
I have a grid control where Edit loads a Data Form. When the user Clicks Okay and the system returns to the Grid Control it puts the user on the bottom most record of the control instead of keeping them on the record they edited. Any ideas why?
[Reply][Quote]
Bob (RJ)Ledger
Posts: 1103
Top 10 forum poster: 1103 posts
 
Re: Grid Control - Staying on the Same RowYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Dec 06 9:11 AM
fiogf49gjkf0d
It's the way it works The grid gets (auto) refreshed and goes back to it's initial state.
Now you could capture the PKID ( IdIwasEditing = datagrid.GetCurrentField ) and then re-position yourself after the edit is complete by trapping the OnEdited event.

I'd probably simplify it by launching the Edit Form via code and not "bound" using Application.MainViews.AddEx and capture the Result> .. something like:
iResult = Application.MainViews.AddEx(Form,0,True,True,ID,"")
If iResult = mrOK then
... user clicked ok
Else
..user canceled
End If

..Get the idea?
--
rjl
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Grid Control - Staying on the Same RowYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Dec 06 11:50 AM
fiogf49gjkf0d
You can control that by saving the selection, then set the selection back after the form closes. Loop through DataGrid1.Selection and save those values, then set them back by adding each value back to DataGrid1.Selection.Add(savedId).
[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: Grid Control - Staying on the Same RowYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Dec 06 1:59 PM
fiogf49gjkf0d
Couple of things in reply to both posts actually:
1) .Selection was a 6.2 introduction I believe. It requires multiselect = true. I believe it also requires the primary key to be invisible at column 0.
2) Grid.GetCurrentField("") works without the need of an invisible column but I believe it doesn't work with multiselect = true. It should be an either/or scenario.

The technique I use for a similar outcome is to place a stringKeyFieldValue variable outside all routines. I then use OnEditingRow to set stringKeyFieldValue = Sender.Selection (or GetCurrentField("") depending on the need). Then all you'd need to do is set your OnEdited event to repopulate the selection.

Incidentally, I also trap a temporary value using OnEdited during inline editing. This lets me go back in the case of a validation problem with the new value.
[Reply][Quote]
Rick Smith
Posts: 96
 
Re: Grid Control - Staying on the Same RowYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Dec 06 10:50 AM
fiogf49gjkf0d
I've been struggling with a similar problem in 6.2, and have finally found a solution so figured I'd add it to this thread. I have a datagrid that I am setting SQL and column properties at runtime. The user can right-click on the selected row (multiselect=false) and open a lookup. After completing the lookup, the recordset in the datagrid is refreshed.
I want the selected row to continue to be selected using DataGrid1.Selection.Add stringKeyFieldValue, but the &$#*! datagrid kept returning to the first row! I searched around for methods to get this to work until I found a post relating to a datagrid's Sortable property. Because I am setting the SQL and adding columns at runtime, the Sortable=true property must be set in code _after_ these steps. Adding DataGrid1.Sortable = true solved the problem . From threads on CRMToolbox, this appears to be a change in 6.2 from previous versions (or maybe just SP3?), wherein the datagrid doesn't load all of the records unless Sortable is true.
[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: Grid Control - Staying on the Same RowYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 06 Dec 06 1:43 PM
fiogf49gjkf0d
When a grid is updated, typically the recordset would only hold the updated value. I ran into this issue because I used a listview with checkboxes to simulate a multi-select grid back in 6.1. I had a nice time trying to debug why it happened and it never occured to use sortable = true (or anything that would load the entire recordset into memory). I believe what happens is the grid caches the information in an internal structure. Sortable = true just makes sure the recordset retains a copy of this structure.

There are definitely some "pitfalls" when doing certain things with the grid. It's kind of a shame no one's really documented them in one place.
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Grid Control - Staying on the Same RowYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 06 Dec 06 2:13 PM
fiogf49gjkf0d
Quote:
Originally posted by Rick Smith

...wherein the datagrid doesn't load all of the records unless Sortable is true.


Sounds like a problem with virtual server-side cursors. When you sort a column (non-indexed) it causes the VSSC to retrieve all rows so they can be sorted. Otherwise it is only paging in sets of records - as you scroll down a grid it is continually retrieving more records as needed. The VSSC implementation will only retrieve all primary key values from the results and then retrieve the other fields as needed. Not sure what that means for your issue, but they sure sound related. You can force the grid to not use VSSC. Maybe that would fix the problem?
[Reply][Quote]
Rick Smith
Posts: 96
 
Re: Grid Control - Staying on the Same RowYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 07 Dec 06 7:36 AM
fiogf49gjkf0d
Hey Ryan, you have me curious now. How would you disable VSCC for a specific grid? The "Sortable" property appeared to be the mechanism to do this, but sounds like there is another way...
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Grid Control - Staying on the Same RowYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 07 Dec 06 8:58 AM
fiogf49gjkf0d
The v7 DataGrid actually has a property called "UseVSSC" you can check or uncheck to force either way (although checking it to force a VSSC the normal rules for a VSSC still apply)
[Reply][Quote]
Rick Smith
Posts: 96
 
Re: Grid Control - Staying on the Same RowYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 07 Dec 06 9:45 AM
fiogf49gjkf0d
Oh, sure, version seven! One more reason to upgrade.
[Reply][Quote]
Bob (RJ)Ledger
Posts: 1103
Top 10 forum poster: 1103 posts
 
Re: Grid Control - Staying on the Same RowYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Dec 06 7:56 AM
fiogf49gjkf0d
Quote:
Originally posted by Ryan Farley

The v7 DataGrid actually has a property called "UseVSSC" you can check or uncheck to force either way (although checking it to force a VSSC the normal rules for a VSSC still apply)


Word of warning on using VSSC on a datagrid:
It's a ReadOnly deal w/fwd/back "scrolling".
--
rjl
[Reply][Quote]
Jeff L
Posts: 65
 
Re: Grid Control - Staying on the Same RowYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Dec 06 2:53 PM
fiogf49gjkf0d
We are using v 6.1.2.

I have a tab that lists items in a grid. My process allows the user to create a new item. When a new item is created I need the grid to refresh and to have the new item selected.

I am have a (*$(* of a time getting the new item selected.

Any hints?
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Grid Control - Staying on the Same RowYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Dec 06 2:56 PM
fiogf49gjkf0d
Not going to be possible in 6.1.2. The grid control in 6.1 lacked many core "features" - this being one of them.
[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/6/2025 11:23:44 AM