Apr 17, 2020, 7:27 PM
[CLOSED] Left and right buttons in the text field
Hello support team,
I intend to create my own picker with buttons inside the input field:
View
Everything is OK the first time the window is displayed. However, when I close it and try to open for a second time, I get a "Cannot read property 'apply' of null" error message. I found that the left and right buttons are causing the problem. When they are removed from the component, no error occurs and the window can be opened and closed as many times as you want.
I tried to play with different destroy methods, but it did not lead to any satisfactory outcome. Can you help me, please?
Thank you for your effort.
Kind regards
Dan
I intend to create my own picker with buttons inside the input field:
View
@using Ext.Net;
@using Ext.Net.MVC;
@{
Layout = null;
var X = Html.X();
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="~/IconFieldTest/widget/IconField.js?@DateTime.Now"></script>
<script type="text/javascript">
function show() {
new Ext.window.Window({
xtype: "window",
closeAction: "destroy",
hidden: true,
items: [{
xtype: "iconfield",
padding: 10
}]
}).show();
}
</script>
</head>
<body>
@(X.ResourceManager())
@(X.Container()
.Items(
X.Button().Text("Show Window").Width(100).Margin(10).AutoFocus(true).Handler("show()")
)
)
</body>
</html>
ComponentExt.ns("Ext.ux.form");
Ext.define("Ext.ux.form.IconField", {
extend: "Ext.form.field.Picker",
alias: "widget.iconfield",
leftButtons: [{
iconCls: "#Shading",
}],
rightButtons: [{
iconCls: "#ArrowNsew",
}],
createPicker: function () {
var me = this,
picker = new Ext.panel.Panel({
pickerField: me,
floating: true,
hidden: true,
ownerCt: this.ownerCt,
renderTo: document.body,
bodyPadding: 5,
height: 300
});
return picker;
}
});
Ext JS 7.1.0.46 / Ext.NET 5.1.0
Everything is OK the first time the window is displayed. However, when I close it and try to open for a second time, I get a "Cannot read property 'apply' of null" error message. I found that the left and right buttons are causing the problem. When they are removed from the component, no error occurs and the window can be opened and closed as many times as you want.
I tried to play with different destroy methods, but it did not lead to any satisfactory outcome. Can you help me, please?
Thank you for your effort.
Kind regards
Dan
Last edited by fabricio.murta; Apr 21, 2020 at 4:55 PM.