javascriptextjsextjs6-modernextjs6.2

Extjs 6.2.0 modern filefield as button


I am trying to create a filefield as a button with an icon. It seems in the documentation that this is not supported in modern 6.2.0. Is there a way?

Link to Docs: http://docs.sencha.com/extjs/6.2.0/modern/Ext.field.File.html

There also doesn't seem to be a way to change the text in the default button or text accompanying it.


Solution

  • That is by design. The file input's text is browser defined and not meant to be changed by the developer. Usually people work around that by generating a display:hidden file input and a generic button which triggers the file input via JS.

    I fear you'll have to divert to similar measures in ExtJS.

    For reference here's a discussion on SO about how to change the label of the plain-old HTML file input element: Labeling file upload button