Description Usage Arguments Details Value Note Examples
The svalue<-
method is used to specify value by name or by
index.
The name gdroplist is an alternative (not encouraged) for gcombobox
1 2 3 4 5 6 7 8 9 | gcombobox(items, selected = 1, editable = FALSE, coerce.with = NULL,
handler = NULL, action = NULL, container = NULL, ..., width = NULL,
height = NULL, ext.args = NULL, autocomplete = FALSE,
initial.msg = "", tpl = NULL)
gdroplist(items, selected = 1, editable = FALSE, coerce.with = NULL,
handler = NULL, action = NULL, container = NULL, ..., width = NULL,
height = NULL, ext.args = NULL, autocomplete = FALSE,
initial.msg = "", tpl = NULL)
|
items |
a vector or data frame of items to choose
from. Coerced to character class. Use |
selected |
initially selected item, by index. Use |
editable |
logical. Does combobox allow editing. A bug (or
package writer's limitations) in extjs do not allow one to set the
value if it is a potential index (when |
coerce.with |
Function. If given, called on value before returning |
handler |
optional means (to |
action |
Passed to handler to parameterize a call |
container |
A parent container. In gWidgetsWWW2 a
parent container is not optional (though it can be substituted
with the |
... |
Used to pass along argument to the parent container's
|
width |
width in pixels of component. Sizing in
gWidgetsWWW2 is sometimes necessary as the arguments
|
height |
height in pixels of the component. |
ext.args |
The contructors of gWidgetsWWW2 ultimately
call an Ext constructor. The options passed to the Ext constructor
may be added to or overridden by use of this argument. Values are
passed in as named list components and with values converted into JavaScript
objects by |
autocomplete |
If |
initial.msg |
If |
tpl |
a template for the item. This is an HTML snippet, where
the column names, when wrapped in braces, will be substituted for
the values. The first three columns have their names normalized to
|
The default change handler differs depending whether the field is
editable. If not, then the handler is called before the selection
is finalized. Otherwise, the handler is called on the "change"
event, which is to track "user-initiated change is detected in the
value of the field." This does not always fire on selection by an
item. To force that, use the add_handler_select
method.
an ExtWidget instance
The [<-
method is note working. The tpl
argument is not working as we'd like.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | w <- gwindow()
sb <- gstatusbar("Powered by gWidgetsWWW and Rook", cont=w)
g <- ggroup(cont=w, horizontal=FALSE)
cb <- gcombobox(state.name, cont=g)
addHandlerChanged(cb, handler=function(h,...) {
galert(paste("You selected ", svalue(h$obj), sep=""), parent=w)
})
## initial message
gcombobox(state.name, cont=g, selected=0, initial.msg="Choose a state...")
## autocomplete
cb <- gcombobox(state.name, cont=g, autocomplete=TRUE)
## template
w <- gwindow()
g <- gvbox(container=w)
tmp <- "http://upload.wikimedia.org/wikipedia/commons/thumb/"
icons = paste(tmp, c("5/5c/Flag_of_Alabama.svg/22px-Flag_of_Alabama.svg.png",
"e/e6/Flag_of_Alaska.svg/22px-Flag_of_Alaska.svg.png",
"9/9d/Flag_of_Arizona.svg/22px-Flag_of_Arizona.svg.png"), sep="")
d <- data.frame(name=c("Alabama", "Alaska","Arizona"),
icon=icons,
tooltip=c("Audemus jura nostra defendere",
"North to the future",
"Ditat Deus"
),
extra=c(
"Montgomery",
"Juneau",
"Phoenix"),
stringsAsFactors=FALSE)
cb <- gcombobox(d,
tpl="<img src=\"{icon}\"></img><span data-qtip=\"{tooltip}\"> {name},
Capital is <em>{extra}</em></span>",
cont=g)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.