Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Search is failing after a column sort.
Message
De
08/08/2003 08:54:29
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Search is failing after a column sort.
Divers
Thread ID:
00818156
Message ID:
00818156
Vues:
63
I have a grid that I display search results in. I use a select statement to define a new cursor and then display that new set in the grid.

I also have the grid header modified so that you can click on the header and order the column. The problem is if I do a search then order a column then do another search, the last search fails, it is always empty.

Strangely though, if I open the form, order the column and do a search, it works well. It only fails if I order the column after a search.

I am setting the grid header at runtime via
**replace headers with my header class 
**enables click methods in header
LOCAL lcCaption
For Each oColumn In Thisform.grdmy1.Columns
	With oColumn
		lcCaption= ALLTRIM( .Header1.caption)
		.removeobject("header1")
		.Newobject("header1", "_mygridheader", "myheader.prg")
		.header1.caption=(lcCaption)
	Endwith
Endfor
where myheader.prg is:
define class _mygridheader as header
         procedure DblClick
         	IF TYPE(this.parent.controlsource)!='M'
				thisform.zsortcolumn(this.Parent.controlsource,this.Parent.columnorder)
			ELSE
					thisform.omessage.warning(PROPER('The Data source of this column '+;
					'is a MEMO field. This type of sorting is currently not available. '))
			endif	
         endproc
enddefine
and zsortcolumn is:
LPARAMETERS cSortField, nColumn
LOCAL lcIndexField, lnActiveColumn

lcIndexField=ALLTRIM(m.cSortField)
lcIndexField=SUBSTR(lcIndexField,AT('.',lcIndexField)+1)

IF UPPER(ALLTRIM(thisform.zlastorder))=='DESC'
	thisform.zlastorder='ASC' &&ENDING'
ELSE
	thisform.zlastorder='DESC' &&ENDING'
ENDIF

thisform.zSearch((thisform.cworkarea),'RESULTS',(lcIndexField+' '+thisform.zlastorder))
thisform.grdmy1.ActivateCell(thisform.grdmy1.ActiveRow,m.nColumn)
thisform.grdmy1.SetFocus()
The header click on the column just performs another search with an order set. It's like setting the order ruins my next search.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform