About the operation of data-hide

Hi,

I have a question about how data-hide works. It is difficult to explain in text, so I will use pictures to explain it.

form:
  - queue
  - gpus
  - opengl
attributes:
  queue:
    widget: select
    options:
      - [ "normal node", "normal", data-hide-gpus: true, data-hide-opengl: true ]
      - [ "gpu node", "gpu" ]
  gpus:
    widget: select
    value: "0"
    options:
      - [ "0", "0", data-hide-opengl: true ]
      - [ "1", "1" ]
      - [ "2", "2" ]
  opengl:
    widget: check_box

The screen visited for the web form generated by the above form.yml is shown below.

Next, select “gpu node” from Queue and you will be taken to the below screen.

Here, you can see the OpenGL checkbox.
Is it possible to hide this checkbox using the above flow ?
Of cause, when you select “1” from Gpus and then select “0” again, the OpenGL checkbox will disappear. But I want it to be invisible from the beginning.

Best,

So when I copied this I had the behavior that you’d expect. This makes me think that you’ve launched this application in the past with gpus set to 1 or more and this value is being cached.

So what you’re seeing when the page loads is the fact that gpus is not the defualt 0 that you’ve provided, but instead the cached value of 1 or 2.

You can disable caching by setting cacheable attribute to false. This way the starting value of gpus will always be 0 as you’ve set it there. (hacking around I had to set it on both queue and gpus, so you may have to play around a bit with it).

  gpus:
    widget: select
    value: "0"
    options:
      - [ "0", "0", data-hide-opengl: true ]
      - [ "1", "1" ]
      - [ "2", "2" ]
   cacheable: false

By the way - you probably also want a data-set-gpus=0 attached to the normal node option. Unfortunately, we don’t have a lot of support for checkboxes at this time so there’s no way to reset that value.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.