I use SPT and I never allow for editing of values in a grid. Here's how I've approached the issue...

In the LOAD event I do my first SPT with a "SELECT field1, field2, field3 FROM myTable WHERE 1=2;" into a cursor (lets call it c_MyTable) that lives throughout the life of the form.
In the INIT event, I bind my grid to c_MyTable and set my column headers.
In that same INIT, I will do my default search calling THISFORM.SearchMyTable( THISFORM.txtSearch.Value ) which should be empty at this point. If someone types into the THISFORM.txtSearch field, in the InteractiveChange event, it calls through THISFORM.SearchMyTable( THISFORM.txtSearch.Value ).
In the THISFORM.SearchMyTable() method, it does something like this....

PARAMETER tcSearch
lcCommand = "SELECT field1, field2, field3 FROM myTable WHERE TRIM(field1) LIKE '" + tcSearch + "%' ORDER BY field1 LIMIT 1000;"
llSuccess = goApp.SPTSelect( lcCommand, 'tempMyTable' )

DO CASE
    CASE NOT USED("tempMyTable")
        && Problem!
    CASE NOT USED("c_MyTable")
        && Problem!
    OTHERWISE
       SELECT c_MyTable
       && Make sure SET SAFETY IS OFF
       ZAP
       APPEND FROM DBF(tempMyTable)
       USE IN tempMyTable
       && Refresh the grid and set LockScreen = .F.
ENDCASE

I can get clickable headers as long as it works with the limit of 1000 records above by modifying the grid or using a subclass. Worked for me for years and years.

HTH.

CULLY Technologies, LLC
http://cullytechnologies.com
http://cully.biz

On 08/04/2015 11:05 AM, Dave Crozier wrote:
Just asking those of you out there who use SPT with an SQL Back End how you 
handle Grid refreshes (refreshing the underlying data) when browsing tables on 
the main data server assuming that you may well stay on a browse window when  
somebody else may well update the data.

I am just trying to write a small set of demo forms using Remote views, Cursor Adapters 
as well as SPT for Tom here in order to better explain the advantages/disadvantages of 
each data access method. Obviously with cursor adapters you can issue a cursorRefresh() 
against the back end and with remote views you can do a requery() against the view. The 
only method I use with SPT is in fact to issue the "select..." again.

Anyone got any better suggestions apart from using stored procedures on the 
back end which I don't really want to use.

The nice thing about the remote view and cursor adapter method is that the 
currently selected row gets preserved in the grid. I have tried the same in SPT 
by saving the current row and navigating to it after the re-select but it 
causes screen glitches regardless of using _Screen.Lockscreen unless anyone 
else has a better idea!

Dave



--- StripMime Report -- processed MIME parts ---
multipart/alternative
   text/plain (text body -- kept)
   text/html
---

[excessive quoting removed by server]

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/55c0db12.3000...@cullytechnologies.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to