Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Refresh cBizObjMaintenanceForm Grid
Message
From
05/10/2004 17:48:10
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Title:
Refresh cBizObjMaintenanceForm Grid
Miscellaneous
Thread ID:
00948962
Message ID:
00948962
Views:
42
Hi All,

I'm using a CursorAdapter to load SQL data into my business object that supplies my cBizObjMaintenanceForm with data.

The problem started when I added a record then tried to delete it immediately afterwards. The problem is that the cursor has not been refreshed so the Primary Key value is not yet in the FoxPro cursor.

I tried to requery the business object (which gets the primary key) but now the grid is all goofy.

I've tried setting the record source, column count, column control sources but all it does is display the primary key values (which I don't want). I've tried it with refreshing the grid and also setting focus to the grid and still no luck.

I know this is not supposed to be that difficult. Can anyone offer insight as to what I need to do, or what I'm doing wrong.

I put this code in the form's PostSaveHook method:
LOCAL lcGridRecordSource
LOCAL lnColumn, lnColumnCount
LOCAL loGridList as Grid
LOCAL loColumnControlSource as Collection, ;
	  loColumnWidth as Collection
LOCAL loColumn as Column

STORE [] TO lcGridRecordSource
STORE 0 TO lnColumn, lnColumnCount
loGridList=ThisForm.pgfBizObj.Page1.cListOneToManyObj1.cGridList1
loColumnControlSource=CREATEOBJECT([Collection])
loColumnWidth=CREATEOBJECT([Collection])

lcGridRecordSource = loGridList.RecordSource
lnColumnCount = loGridList.ColumnCount
FOR EACH loColumn IN loGridList.Columns
	loColumnControlSource.Add(loColumn.ControlSource,loColumn.Name)
	loColumnWidth.Add(loColumn.Width,loColumn.Name)
ENDFOR 

ThisForm.oBizObj.Requery()

loGridList.RecordSource=[]
loGridList.RecordSourceType=1
loGridList.RecordSource=lcGridRecordSource
loGridList.ColumnCount=lnColumnCount
FOR lnColumn = 1 TO loGridList.ColumnCount
	loColumn = loGridList.Columns(lnColumn)
	loColumn.Width = loColumnWidth.Item(loColumn.Name)
ENDFOR 
loGridList.Refresh()
loGridList.SetFocus()
Aloha,

James
Reply
Map
View

Click here to load this message in the networking platform