Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: Grid not ordered correctly

$
0
0
Re: Grid not ordered correctly
FoxInCloud
Re: Grid not ordered correctly
Mar. 8, 2013
03:32 am
3QE07L52OShow this entire thread in new window
Gratar Image based on email address
From:Keith
To:Michele
Hi Michele.


To define the record sources in a grid can be a pain, so what I did
was to make the data source definition more like a List Box.

To do that, in my grid base class I have a property named ColumnDataSource.
I simply populate that with something like Address.Street,Town,County,Postcode.
The INIT code to achieve this is below.

Whilst looking at my code to post to you I noticed that I may have had the same
trouble as you, but not as an FIC application - the LockColumnsCount part of the code.
This code has run for 12 years with over 200 users over a network and never had a problem,
but not yet tested under FIC conditions.


In the base class INIT -:

**************************************************

LOCAL cDataFields, cTableName, nLC, cMacro

* If, for example, there are three fields in Grid data source, but column
* count is set to 2, sometimes, particularly over a network, the grid
* columns are shifted to the left.
IF THIS.LockColumnsCount > -1
IF THIS.LockColumnsCount=0
THIS.LOCKCOLUMNS=THIS.COLUMNCOUNT
ELSE
THIS.LOCKCOLUMNS=THIS.LockColumnsCount
ENDIF
ENDIF


* Not a lot lot of validation here, as not much use when EXE built.
IF NOT EMPTY(THIS.ColumnDataSource)
cDataFields=STRTRAN(THIS.ColumnDataSource, " ", "")
cTableName=SUBSTR(cDataFields, 1, AT(".", cDataFields) -1)
cDataFields=SUBSTR(cDataFields, AT(".", cDataFields) + 1) + ","
THIS.RECORDSOURCETYPE=1
THIS.RECORDSOURCE=cTableName
FOR nLC=1 TO OCCURS(",", cDataFields)
cMacro="This.Column" + ALLTRIM(STR(nLC)) + ".ControlSource='" + ;
cTableName + "." + SUBSTR(cDataFields, 1, AT(",", cDataFields) -1) + "'"
&cMacro
cDataFields=SUBSTR(cDataFields, AT(",", cDataFields) +1 )
ENDFOR
ENDIF

IF EMPTY(THIS.RECORDSOURCE)
MESSAGEBOX("The RECORDSOURCE has not been set in object" + CHR(13) + ;
SYS(1272, THIS) + ".", 48, ;
"Developer Message")
CANCEL
ENDIF

************************************************



I have a form with a grid. In the load() event of the form i open my table

Use myTab1 Order Code In 0Setfiltertotype="DP" In myTab1GoTop In myTab1

but when the form is loaded the grid is not ordered.....
In the grid i set only "RecordSource = myTab1"

What's wrong ?


Viewing all articles
Browse latest Browse all 10393

Trending Articles