FoxInCloud
Grid.RecordSource
Gravatar is a globally recognized avatar based on your email address. Grid.RecordSource
  Vincent H.
  All
  Apr 19, 2018 @ 02:12am

Thierry,

I have a problem with my grid. When I modify the recordSource (after a recordsource = ""), the title and controlsource of the columns are not preserved. The grid appears with all the cursor fields.

Gravatar is a globally recognized avatar based on your email address. re: Grid.RecordSource
  FoxInCloud Support - Thierry N.
  Vincent H.
  Apr 19, 2018 @ 04:12am

Hi Vincent, please post the corresponding code

Also, can you reproduce in desktop mode?

Gravatar is a globally recognized avatar based on your email address. re: Grid.RecordSource
  Vincent H.
  Vincent H.
  Apr 19, 2018 @ 05:40am

No problem in desktop mode. Here is my form with the grid:
Without refresh():
It's ok, except the dimensions of the columns ...
After refresh(): New fields and bad caption (signature)

Page1.Refresh_
DO CreatePartenaire

PROCEDURE CreatePartenaire
   IF VARTYPE (Tabbord) = Cobjet
      Tabbord.PageFrame1.Page1.Grid.RecordSource = Vierge
   ENDIF
   IF USED ("Cdossiers_p")
      * Indispensable ?!
      USE IN Cdossiers_p
   ENDIF
   SELECT Dossier, Dateacte, Prix, Vi.Infos, SUBSTR (Vi.numerodos, 5) AS Numero, Complet FROM Vi INNER JOIN Dossier ON Vi.Numerodos = Dossier.Numerodos INTO CURSOR Cdossiers_p READWRITE
   ALTER TABLE Cdossiers_p ADD COLUMN Etat C(12)
   REPLACE ALL Etat WITH ICASE (Complet = .T. .AND. .NOT. "xxx" $ Infos, "A signer !", Complet = .T., "Complet", "En cours ...") IN Cdossiers_p
   GO TOP IN Cdossiers_p
   IF VARTYPE (Tabbord) = Cobjet
      Tabbord.PageFrame1.Page1.Grid.RecordSource = "Cdossiers_p"
   ENDIF
RETURN

Gravatar is a globally recognized avatar based on your email address. re: Grid.RecordSource
  FoxInCloud Support - Thierry N.
  Vincent H.
  Apr 19, 2018 @ 07:31am

1/ Column width are exactly the same as in desktop

2/ How is the grid populated first time? Using the same procedure?
Are you sure that the initial cursor is also named "Cdossiers_p"?

3/ You can simplify your code:

procedure Page1.Refresh_
DO CreatePartenaire with this.Grid

PROCEDURE CreatePartenaire
lparameters oGrid
   IF VARTYPE (m.oGrid) = Cobjet
     m.oGrid.RecordSource = Vierge
   ENDIF
   USE IN select('Cdossiers_p') && works when used('Cdossiers_p') or not
   SELECT;
     Dossier;
   , Dateacte;
   , Prix;
   , SUBSTR (Vi.numerodos, 5) AS Numero;
   , cast(ICASE(Complet = .T. .AND. .NOT. "xxx" $ Vi.Infos, "A signer !", Complet = .T., "Complet", "En cours ...") as C(20)) as Etat;
   FROM Vi INNER JOIN Dossier ON Vi.Numerodos = Dossier.Numerodos INTO CURSOR Cdossiers_p READWRITE
   IF VARTYPE (m.oGrid) = Cobjet
      m.oGrid.RecordSource = "Cdossiers_p"
   ENDIF
RETURN
Gravatar is a globally recognized avatar based on your email address. re: Grid.RecordSource
  Vincent H.
  FoxInCloud Support - Thierry N.
  Apr 19, 2018 @ 07:38am
  1. Not for me
  2. Tabbord.load()
LOCAL abSelect
abSelect = abSelect()
IF .NOT. USED ("Cdossiers_p")
   DO CreatePartenaire IN \VHDev\Appli\Dooxi\Dooxi.prg
ENDIF
IF .NOT. USED ("CVenacq")
   CREATE CURSOR CVenacq (Lselection L, Partie C(254))
ENDIF
EOFset('Cdossiers_p')
RETURN DODEFAULT()

  1. Yes, thanks
Gravatar is a globally recognized avatar based on your email address. re: Grid.RecordSource
  FoxInCloud Support - Thierry N.
  Vincent H.
  Apr 19, 2018 @ 07:56am

1/ absolute columns widths are the same, they seem smaller in web mode because the grid is wider

you can add this code to expand the columns in Web mode

procedure xxxGrd.Init && or thisSpecificGrid.Init

if thisForm.wlWeb
 local oGrc as Column
 for each oGrc in this.columns foxobject
  m.oGrc.width = m.oGrc.width * 1.5
 endfor
endif

2/ Tabbord.PageFrame1.Page1.Grid does not exist in Tabbord.Load()

You could just let page1.refresh() execute naturally (after tabord.show()) and populate the grid

Do you need "Cdossiers_p" somewhere else?

Gravatar is a globally recognized avatar based on your email address. re: Grid.RecordSource
  Vincent H.
  FoxInCloud Support - Thierry N.
  Apr 19, 2018 @ 08:58am
  1. I'll try
  2. I replaced the call to the procedure with a select ... into Cdossiers_p (this cursor is filled in the RecordSource of the Grid). The result is obviously identical. No, I do not need the cursor after.
  3. Question: with grids in FIC, rather than fill in a Column.ControlSource, is it better to systematically create a cursor whose structure includes only the fields to display and in their order of belonging in the grid ?
Gravatar is a globally recognized avatar based on your email address. re: Grid.RecordSource
  FoxInCloud Support - Thierry N.
  Vincent H.
  Apr 19, 2018 @ 09:10am

2/ what it you remove the call to CreatePartenaire from .Load()? Does it work better?

3/ no such limitation, you can define column.controlSource at design time, should be kept at run time unless we have a bug in your specific case

Gravatar is a globally recognized avatar based on your email address. re: Grid.RecordSource
  Vincent H.
  FoxInCloud Support - Thierry N.
  Apr 19, 2018 @ 09:34am
  1. OK. Fine
  2. This have no effect. Same result. When i refresh my grid, its initial attributes are overwritten
Gravatar is a globally recognized avatar based on your email address. re: Grid.RecordSource
  FoxInCloud Support - Thierry N.
  Vincent H.
  Apr 19, 2018 @ 09:46am

do you have something in grid.recordSource_Assign()?

Gravatar is a globally recognized avatar based on your email address. re: Grid.RecordSource
  Vincent H.
  FoxInCloud Support - Thierry N.
  Apr 19, 2018 @ 10:08am

wcRSCursor_Assign() ? No, just inherited code

Gravatar is a globally recognized avatar based on your email address. re: Grid.RecordSource
  Vincent H.
  Vincent H.
  Apr 19, 2018 @ 10:37am

Too fast, sorry.
Nothing in grid.recordSource_Assign()

Gravatar is a globally recognized avatar based on your email address. re: Grid.RecordSource
  FoxInCloud Support - Thierry N.
  Vincent H.
  Apr 19, 2018 @ 10:59am

could you try to move the code to another method than .refresh?()

Gravatar is a globally recognized avatar based on your email address. re: Grid.RecordSource
  Vincent H.
  FoxInCloud Support - Thierry N.
  Apr 19, 2018 @ 11:17am

Well seen. I put the call to the createpartenaire () in a button with a grid.refresh ().
On the click (), the grid is refreshing and does not modify its properties

Gravatar is a globally recognized avatar based on your email address. re: Grid.RecordSource
  Vincent H.
  FoxInCloud Support - Thierry N.
  Apr 19, 2018 @ 11:20am

Also OK in Activate()

Gravatar is a globally recognized avatar based on your email address. re: Grid.RecordSource
  FoxInCloud Support - Thierry N.
  Vincent H.
  Apr 19, 2018 @ 11:30am

I had this vague souvenir that changing .recordSource in .refresh() created issues

what is strange is that is does not behave the same in desktop mode

Gravatar is a globally recognized avatar based on your email address. re: Grid.RecordSource
  Vincent H.
  FoxInCloud Support - Thierry N.
  Apr 20, 2018 @ 05:23am

Hi Thierry, You're right, the problem also exists in desktop mode. And also with activate().
The properties of the grid are not saved as soon as the data source is modified (even if initialized to "" previously).

Gravatar is a globally recognized avatar based on your email address. re: Grid.RecordSource
  FoxInCloud Support - Thierry N.
  Vincent H.
  Apr 20, 2018 @ 05:30am

I would set a breakpoint in recordSource_assign() to see what's going on:

procedure recordSource_assign

lparameters tRecordSource
set step on
return doDefault(m.tRecordSource)
Gravatar is a globally recognized avatar based on your email address. re: Grid.RecordSource
  Vincent H.
  FoxInCloud Support - Thierry N.
  Apr 20, 2018 @ 06:04am

The RecordSource is well informed

© 1996-2024