simple.param(name, label = name, description = label, value = "", type = "text", advanced = 0, show.if = NULL, display.callback = NULL, size = "medium", required = TRUE, persistent = NULL, persistent.dependencies = NULL, transformer = NULL)
$name
, giving the name of some other param in the set
and $values
, a character vector of values. The parameter under construction should only be shown if
the named parameter takes on any of the values in the $values
vector. Default (NULL) is to always
show the parameter under construction.show.if
logic in deciding when/if
to display the element, or a list with the two elements $uri
and $dependent
,
which follow the same format as the corresponding arguments to combobox.param
and provide
a templated uri and a mapping from template variables to form parameters. The service should
return JSON true if the widget is to be shown and false if not. It is allowed to
have both a display.callback
and a show.if
---both conditions must be
met in order to display the element.known.param.sizes()
(currently
no way to change this). Default: mediumname
).
It is an error to provide this when persistent
is NULL.
When persistent
is non-NULL, providing persistent.dependencies
makes this parameter
not just "persistent" but "conditionally persistent", which
is to say that the persistent value for this parameter is actually a hash lookup based on the
the other parameters specified in this vector. A typical example would be a pheno fields parameter
which is dependent on the study parameter. The names are taken from the Page namespace, which
means that a parameter's $name
is used when this differs from its $persistent
slot.function(value, self)
or function(value)
which accepts
as first argument the JSON-decoded value of the parameter returned from the front end and then performs
some sort of transformation. The return value of the function will be ultimately
passed to AnalysisPage handler. For example, for a field which is a simple text widget
but which is supposed to be numeric you might use transformer = as.numeric
. But you could
also implement more complicated logic here. The reason to put the logic here instead of in the handler
is that it makes it easier to re-use the widget in multiple handlers. If you have a complex (nested) parameter
then the nested elements' transformations, if any, are applied first, then the parental transformation is applied.
Or, NULL (default) to not
do any transformation beyond the JSON decoding.x <- simple.param("xmin", label="X-min", description="Minimum x value", type="text")
# Please see the "Persistent Parameters" and "Conditionally Persistent Parameters"
# sections of the Interactive Apps vignette for demonstrations of these functionalities
Run the code above in your browser using DataLab