the_skua
10 Feb 2012, 8:43 AM
I'm popping up a window with some simple HTML on a button click. Currently, I'm cloning the div node to get the content in the Window. I had been feeding the window the id of the div directly, but it nuked my div on Window hide. So, now I'm worried that all this cloning is going to stack up. I would appreciate it if someone could advise me on the best practice with Window.contentEl. My code follows.
HTML
<div id="modelHelpText" class="x-hidden">Identify whether you are growing a spring wheat (spring planted) or winter wheat (fall planted). This selection will activate different components of the model that will customize the prediction for your crop.</div>
View
Ext.define('RiskMap.view.Models.ModelHelp', {
extend: 'Ext.window.Window',
alias: 'widget.modelhelp',
title: 'Wheat Class',
width: 250,
layout: 'fit'
});
Controller
onHelpClick: function(myB, e) {
var elem = document.getElementById('modelHelpText').cloneNode(true);
var view = Ext.widget('modelhelp');
view.contentEl = elem;
view.setPosition(myB.getPosition()[0]+30,myB.getPosition()[1]);
view.show();
},
HTML
<div id="modelHelpText" class="x-hidden">Identify whether you are growing a spring wheat (spring planted) or winter wheat (fall planted). This selection will activate different components of the model that will customize the prediction for your crop.</div>
View
Ext.define('RiskMap.view.Models.ModelHelp', {
extend: 'Ext.window.Window',
alias: 'widget.modelhelp',
title: 'Wheat Class',
width: 250,
layout: 'fit'
});
Controller
onHelpClick: function(myB, e) {
var elem = document.getElementById('modelHelpText').cloneNode(true);
var view = Ext.widget('modelhelp');
view.contentEl = elem;
view.setPosition(myB.getPosition()[0]+30,myB.getPosition()[1]);
view.show();
},