table visibility

Everything related to the development of modules in jamovi
Post Reply
User avatar
mcfanda@gmail.com
Posts: 457
Joined: Thu Mar 23, 2017 9:24 pm

table visibility

Post by mcfanda@gmail.com »

Hi
I'd like a result table to appear only when some specific results are present. The example is as follows:

in mymodule.r.yaml I have this table definition

- name: cov
title: Random Parameters correlations
type: Table
visible: (showRandomCov)

the value of the variable "showRandomCov" can only be computed after the results are computed. Can I condition its visibility to some result value?

p.s. I've tried to compute showRandomCov in the mymodule.b.R but I get the error "Could not resolve "showRandomCov"
User avatar
Ravi
Posts: 194
Joined: Sat Jan 28, 2017 11:18 am

Re: table visibility

Post by Ravi »

Hi,

You cannot make the visibility of a table dependent on your results using only the YAML. However, you can do this in the analysis file (.b.R). To do this you first have to set the visibility of your table object to false in the .r.yaml like this:

Code: Select all

    - name: cov
      title: Random Parameters correlations
      type: Table
      visible: false
This will hide your table by default. Next you can add a statement in your .b.R file to set visible to true if a certain condition is met. For example like this:

Code: Select all

if (condition == TRUE) {

    table <- self$results$cov
    table$setVisible(TRUE)

}
Now, it will hide your table unless the condition is met.
User avatar
mcfanda@gmail.com
Posts: 457
Joined: Thu Mar 23, 2017 9:24 pm

Re: table visibility

Post by mcfanda@gmail.com »

great, thanks
Post Reply