PDA

View Full Version : Trying to get a parent container for renderTo



Xenology
4 Jan 2012, 12:40 PM
I'm trying to write a function for a form field that will dynamically grab the parent container, so that the date picker renders itself to the correct div. I know i can pass a div straight in, but the issue with this is that whenever i make changes to the code, the unique ID's change and i have to maintain the code.



{
xtype: 'datepickerfield',
name: 'birthday',
label: 'Birthday',
picker: {
yearFrom: 1930,
renderTo: (
function(){
var formContainer = Ext.get(formBase).findParent('div', 10, true);
console.log(formContainer)
return formContainer;
}
)
}
}


This code is resulting in the error:
Uncaught TypeError: Cannot read property 'ownerDocument' of null

Which i can assume is being thrown because the function is returning null to the renderTo. What am i doing wrong here?

mitchellsimoens
5 Jan 2012, 9:15 AM
Why not create an extension on DateField and override the onTriggerClick method. The second to last line in that method is where the element is past

Xenology
5 Jan 2012, 2:12 PM
I'm very new to Sencha and ExtJs as it is so most of that sailed right over my head.