toolkit.loadFileButton {shinylight}R Documentation

JavaScript function: Returns a button that uploads a file from the client.

Description

This button is an HTML element, but it is not an HTML button. Styling and JavaScript provide the button-like look-and-feel.

Arguments

id

string The HTML id of the button will be 'button-' + id. It is also used in the interpretation of the translations argument.

fn

function A binary callback function. Its two parameters are the File object uploaded and a (nullary) function that will be called when the operation completes.

translations

object An object with a key id having a value that is an object having a key 'name' with value the display name of the button, and optionally a key 'help' with value of the tooltip text.

createFileInput

function [optional] A function to create an element that uploads a file. By default this is a normal <input type="file"> with an extra show member function that does nothing. The function takes two parameters: uploadFn and doneFn. uploadFn must be called when a file has been chosen for upload; it takes two parameters: a File object and a callback function that is called on completion. You should either pass doneFn as this second parameter, or a function that performs some actions then calls doneFn() itself. The return value of createFileInput should be the element itself, monkey-patched to include a show() method that will be called when the Load button is clicked.

Value

The button.


[Package shinylight version 1.2 Index]