Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Reset to Defaults behaviour  (Read 24727 times)
Michael Y.
Posts: 8


« on: October 29, 2012, 09:03:54 pm »

I'm getting some unexpected behaviour when Resetting to Defaults in a table. I have a table with 5 columns setup in a form. In a BEFORE DIALOG, I initialize column titles and hide certain columns using the setFieldHidden() method. I also have radio buttons that utilizes an ON CHANGE. When I unhide my columns in the ON CHANGE block, and then in the table, click on "Reset to Defaults", I expect to see the same number of columns. Instead, columns become hidden again as they were when initializing my table columns in the BEFORE DIALOG. This doesn't happen if I don't try to hide columns in the BEFORE DIALOG, but ideally I would like to. Is this to be expected? Thank you.
Sebastien F.
Four Js
Posts: 545


« Reply #1 on: October 30, 2012, 09:29:04 am »

Hello Michael,
What value are you passing to ui.Form.setFieldHidden()? This method can take 0, 1 or 2, depends on what you want to achieve.
Please provide a sample, will be easier to understand as a long text.
Seb
Michael Y.
Posts: 8


« Reply #2 on: October 30, 2012, 01:55:32 pm »

Hello, here's a sample of the code. I've experimented with different values being passed through setFieldHidden but the behaviour stays the same.

MAIN

  DEFINE w ui.Window,
               f  ui.Form

  OPEN WINDOW w1 WITH FORM "test_table"

  LET w = ui.Window.getCurrent()
  LET f = w.getForm()
 
  DIALOG ATTRIBUTES(UNBUFFERED,FIELD ORDER FORM)

    INPUT BY NAME toggle
      ON CHANGE toggle

        IF toggle = 1 THEN
          CALL f.setFieldHidden("formonly.field4",1)
          CALL f.setFieldHidden("formonly.field5",1)
        ELSE
          CALL f.setFieldHidden("formonly.field4",0)
          CALL f.setFieldHidden("formonly.field5",0)
        END IF
      END INPUT

    DISPLAY ARRAY t_array TO test_array.*
    END DISPLAY

    ON ACTION cancel
      EXIT DIALOG

    ON ACTION accept
      EXIT DIALOG

    BEFORE DIALOG
      CALL f.setElementHidden("formonly.field4",1)
      CALL f.setElementHidden("formonly.field5",1)
  END DIALOG

  CLOSE WINDOW w1

END MAIN

Thanks for your input!


* ResettoDefaults.png (44.52 KB, 451x837 - viewed 2950 times.)
Sebastien F.
Four Js
Posts: 545


« Reply #3 on: October 30, 2012, 04:05:12 pm »

Can we get the form file as well?
Seb
Michael Y.
Posts: 8


« Reply #4 on: October 30, 2012, 04:12:17 pm »

No problem,

LAYOUT
  VBOX
    GROUP

    FOLDER
      PAGE (TEXT="Table Test")
        TABLE
        {
           Col 1          Col 2             Col 3             Col 4            Col 5
          [f1              |f2                |f3                 |f4                |f5                   ]
        }
        END -- TABLE
      END -- PAGE
    END -- FOLDER

    END -- GROUP

    GROUP (TEXT="Hide/Show columns")
      GRID
      {
        [f001]
      }
      END -- GRID
    END -- GROUP
END -- LAYOUT

ATTRIBUTES

EDIT                f1 = FORMONLY.field1;
EDIT                f2 = FORMONLY.field2;
EDIT                f3 = FORMONLY.field3;
EDIT                f4 = FORMONLY.field4;
EDIT                f5 = FORMONLY.field5;

RADIOGROUP f001 = FORMONLY.toggle_table,
                  ITEMS=((1,"3 columns"),(2,"5 columns")),
                  DEFAULT=1;

END -- ATTRIBUTES

INSTRUCTIONS

  SCREEN RECORD test_array (
    FORMONLY.field1,
    FORMONLY.field2,
    FORMONLY.field3,
    FORMONLY.field4,
    FORMONLY.field5);

END -- INSTRUCTIONS


The array was defined in the 4gl outside of main, just to be clear.
Sebastien F.
Four Js
Posts: 545


« Reply #5 on: October 30, 2012, 04:31:10 pm »

I admit we have a design issue here...
We must discuss this internally, but I think that the front-end must not write hidden columns in stored settings when the hidden attribute is 1...
Please send a mail to support, with sample code attached.
Seb
Michael Y.
Posts: 8


« Reply #6 on: October 30, 2012, 04:40:02 pm »

I will mail support about this particular issue. Thanks again for your time.
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines