I have a component which has an input type specified under the HTML propertie so that it renders like an input type. But I have trouble geetting the value of the input type....
Component:
xtype: 'component',
html: {
html: '<input id=\'colorPickerBackground\' type=\'color\' onchange=\'myFunction()\' ></input>'
},
itemId: 'colorPicker',
listeners: {
afterrender: {
fn: me.onComponentAfterRender,
scope: me
}
}
On a certain Ext.js event I want to get the value of the input type inside html??
In your case code you can do something like this:
afterrender: function(component) {
// Color input is Ext.dom.Element instance
var colorInput = component.getEl().down('#colorPickerBackground');
// Use .down('#colorPickerBackground', true) to get actual DOM element
}
More about navigating through DOM with ExtJS in this answer .
Since you trying to create color picker you have to look at Ext.picker.Color
.
If you still want to do it on your own take a look at Ext.form.field.Base
, you can use it as base for your color picker.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.