Description Usage Arguments Details Value Methods Note Examples
A widget for displaying a data frame in tabular format. The main
property is the set of indices for the currently selected
rows. For large data sets, the data can be "paged", that is given
to the browser in bite-sized chunks so the lag is lacking. The
change handler is for a single click, also used for selection. Use
addHandlerDoubleclick
to specify a callback for the double
click event on a cell.
The table widget is implemented using a proxy. That is, the data is loaded in a separate AJAX call. This makes things relatively responsive, but if there is too much data one can turn on paging.
1 2 3 4 5 |
items |
data frame of items to display |
multiple |
logical. TRUE for multiple selections |
chosencol |
The svalue() method returns a single value, by default. This species column of that value. |
icon.FUN |
NOT IMPLEMENTED. Instead, just add a column with class Icon containing css class of the icons |
filter.column |
Ignored |
filter.labels |
Ignored |
filter.FUN |
Ignored. |
handler |
single click handlers |
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 |
additional configuration values to pass to constructor |
paging |
Either a logical variable or integer. If |
col.widths |
width of each column. Also see |
The column names are inherited from the columnnames of the data frame.
A column of class "Icon" (see
asIcon
) will render a css class as an icon. See the
example.
The item replacement operator [<-
will work
only if all the column types remain constant, as the column
renderers are set at time of construction. This also effects the
initial data frame. Pass a 0-row data frame with column names and
defined column types at construction if no data is known at that
point.
The widget can filter through the visible method. This basically
passes back the filtered data from the server each time it is
called. To avoid the data transfer, one can use the filter
reference method, which filters browser side by a regular
expression.
An ExtWidget instance
filter(colname, regex)
Use filter by regular expression. No visible<- method to adjust visible rows
get_value(...)
Get main property, Can't query widget, so we store here
param_defn(signal)
Define different parameter definitions based on the signal
process_transport(value, ...)
R Function to process the transport. Typically just sets 'value', but may do more. In the above example, where var param = value: this.getText() was from transport_fun we would get the text for value
set_value(value, ...)
Set main property, invoke change handler on change
transport_fun()
javascript function for transport web -> R. Creates an object param. This is a string to be passed to the javascript queue withing the transport function call E.g. var param = value: this.getText()
With width
and/or height
set to NULL
,
the default size will likely be unsatisfying. (And can consume any
space in a box, so items packed in after will not be shown.) As
such, these values are often best set by the programmer. They can
be readjusted through the size<-
method. The size<-
method can also be used to adjust the columns widths, by passing a
list with a component named columnWidths
containing the
desired widths in pixels.
The visible<-
method may be used for filtering.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | w <- gwindow("Filtering and table example")
sb <- gstatusbar("Powered by gWidgetsWWW and Rook", cont=w)
g <- ggroup(cont=w, horizontal=FALSE)
g1 <- ggroup(cont=g)
glabel("Filter by:", cont=g1)
e <- gedit("", cont=g1)
tbl <- gtable(data.frame(name=state.name, stringsAsFactors=FALSE), cont=g, multiple=TRUE)
addHandlerKeystroke(e, handler=function(h,...) {
val <- svalue(h$obj)
if(nchar(val) > 0) {
tbl$filter("name", val)
}
})
b <- gbutton("click", cont=g, handler=function(h,...) galert(svalue(tbl, index=FALSE), parent=w))
## icons
m <- mtcars[1:3, 1:4]
## add icons as css class
m[,1] <- asIcon(c("up","up","down"))
gtable(m, cont=g)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.