FilePicker
A file input wrapped in a Button. Clicking the button opens the browser's native file picker dialog. When files are selected, a badge shows the count and hovering reveals a tooltip listing file names. Configure the underlying file input via fileFieldConfig (e.g. multiple, accept) and the button appearance via buttonConfig. Listen for selections with the change event.
const filePicker = new FilePicker({
fileFieldConfig : {
multiple : true,
accept : 'image/*'
},
buttonConfig : {
text : 'Pick file...'
},
onChange({ files }) {
// Do cool things
},
appendTo : document.body
});
Useful configs and events
| Config | Description |
|---|---|
| fileFieldConfig | Configuration for the underlying FileField |
| buttonConfig | Configuration for the pick button |
| change | Fired when files are selected |
See also
Configs
Configs are options you supply in a configuration object when creating an instance of this class-
Underlying field config object. See FileField for list of available configs.
-
Set to
falseto hide the badge indicating the number of files selectedHas a corresponding runtime showBadge property.
-
The name of the property to set when a single value is to be applied to this FilePicker. Such as when used in a grid WidgetColumn, this is the property to which the column's
fieldis applied.
Properties
Properties are getters/setters or publicly accessible variables on this class-
Identifies an object as an instance of FilePicker class, or subclass thereof.
-
List of selected files
-
Set to
falseto hide the badge indicating the number of files selectedHas a corresponding showBadge config.
-
Identifies an object as an instance of FilePicker class, or subclass thereof.
Functions
Functions are methods available for calling on the class-
clear( )
Clears field