Widget Properties
These widget properties are used in functions like gui.setProperties()
.
Widget Properties List
These properties are generally available to all widgets:
Property | Default | Description |
---|---|---|
value |
"" |
The value of the widget. |
isr |
FALSE |
If the value is an R expression. |
css |
"" |
A list of CSS styles or a list of CSS class names. |
margintop |
10 |
The space over the widget in pixels. |
labeltext |
"" |
The text of the label. |
labelposition |
"left" |
The position of the label. Can be "left" , "top" , "topaligned" or "hidden" . |
helptext |
" |
The help text below the widget. |
helpposition |
"bottom" |
The position of the help text. Can be "bottom" or "label" . |
required |
FALSE |
If the input is required. |
onchange |
"" |
R Code to execute when the widget's value changed. |
condition |
"" |
R condition when submitting the form. |
Specific widgets properties
Buttons
Property | Default | Description |
---|---|---|
onpress |
"" |
R code to execute when pressing the button. |
buttonsize |
"md" |
The size of the button. Can be "sm" , "md" , "lg" or "fw" . |
buttondesign |
"primary" |
The style of the button. Can be "primary" , "secondary" , "success" , "info" , "warning" , "danger" , "light" or "dark" . |
Columns
Property | Default | Description |
---|---|---|
columnswidths |
c(4, 4, 4) |
The widths of each columns. |
columnspadding |
10 |
The padding between each columns. |
Graphs
Property | Default | Description |
---|---|---|
graphtitle |
"" |
|
graphx |
"" |
|
graphy |
"" |
Grids
allowSort
Allow the client-side sorting of the columns. Defaults to true
.
gridAllowFiltering
Allow the filtering of the columns. Defaults to true
.
gridAllowRowEditing
Allow to dynamically add rows when pasting from Excel or from another source.
gridColumns
The columns labels as a vector of strings.
gridColumnsWidths
A vector of column widths in percentage. For example c(20, 10, 70)
will set the first column to 20% of the total grid width, 10% for the second column and 70% for the third and last column.
gridHeight
The total height of the grid. Leaving it to 0 will automatically determine a height.
gridnbcolumns
The number of columns.
gridnbrows
The number of rows.
gridRows
The rows labels as a vector of strings.
gridRowsRender
Show or hide the row labels columns.
gridStylingRules
Styling and formatting rules to apply. This should be a list of lists (R) or an array of array (python). Each final list/array should have either code, css
or code, format, numberFormat
entries.
code
is a simple programming language that must return true or false to determine if the CSS or the formatting rule will apply. This code is called and tested for each displayed cells in the grid. Operators like ==
, ===
, !=
, !==
, >
, >=
, <
, <=
, &&
, ||
, parentheses ()
, strings, boolean true
/false
and numbers are supported. There are also special keywords:
col
is the column index (starting with 0) of the currently tested cell;colname
correspond to the column name of the currently tested cell;row
is the row index of the cell;rowname
is the row name of the cell;value
correspond to the value of the cell.
css
is the css code that will be apply inline in a style=""
HTML tag for the cell.
format
and numberFormat
determine how the data will be displayed. Currently, format
only support one value: number
, which will then use the numberFormat
to format the number. numberFormat
is a string that can contain a prefix, a suffix, thousands separator, decimal separator and unforced (#
) or forced (0
) digits. Here are some examples:
Number format | Number | Output |
---|---|---|
#,##0.#### |
1234567.890 | 1,234,567.89 |
$ #,###.00 |
-1234567.890 | $ -1,234,567.89 |
Here are some complete example of gridStylingRules
:
# The first rule will format all numbers in the disp column to a French currency format.
# The second rule will display all values in the disp column above 300 in green.
# Third rule will display all values in the disp column below 100 in red.
gui.setProperty("this", "grid", "gridStylingRules", list(
list(code="colname === 'disp'", format="number", numberFormat="# ###,00 €"),
list(code="colname === 'disp' && value > 300", css="color: #0F0"),
list(code="colname === 'disp' && value < 100", css="color: #F00")
))
Warning
Please note that setting gridStylingRules
multiple times will not append new rules, but will replace all previous rule.
gridType
The type of the grid. Can be "text"
, "integer"
, "float"
or "checkbox"
. If the variable passed to the grid is a data frame, this property is ignored.
readOnly
Disable sending back grid data after submit. Can be used for big read-only data for preventing lags.
Labels
Property | Default | Description |
---|---|---|
fontsize |
14 |
The size of the font in widget. |
fontfamily |
"default" |
The family of the font. |
fontcolor |
"#000000" |
The color of the font. |
Lists
Property | Default | Description |
---|---|---|
boxdesign |
"light" |
The style of the list. Can be "primary" , "secondary" , "success" , "info" , "warning" , "danger" , "light" or "dark" . |
boxheader |
"" |
The list header. |
Numbers
Property | Default | Description |
---|---|---|
min |
"" |
The minimal value allowed. |
max |
"" |
The maximal value allowed. |
step |
"" |
The step between each value. |
Progress
Property | Default | Description |
---|---|---|
progresscolor |
"#27ae60" |
The color of the progress bar or circle. |
progressdescription |
"%" |
The text of the progress bar or circle. |
R Repeaters
Property | Default | Description |
---|---|---|
intervalcode |
"" |
The R Code to execute. |
intervaltime |
1000 |
The interval in ms between each R execution. |
Tabs
Property | Default | Description |
---|---|---|
tabsnames |
[] |
The names of the tabs. |
tabscurrent |
1 |
The currently selected tab index. |