If I add a button to my panel via a 'renderTo' argument (See 'b' below), it works perfectly :
//create div in javascript
var extJSTest = document.createElement('div');
//append to main
mainPanel.appendChild(extJSTest);
//'get' panel through EXT (just adds a wrapper?)
var myDiv = Ext.get(extJSTest);
var b = Ext.create('Ext.Button', {
text: 'Click me!!!!',
renderTo: myDiv,
handler: function() {
alert('You clicked the button!')
}
});
However, if, I replace the 'b' with the following code (That is, i want to replace the button with a grid, connected up with a SimpleStore and some data)...
var myData = [
['Apple',29.89],
['Ext',83.81]
];
var ds = new Ext.data.SimpleStore({
fields: [
{name: 'company'},
{name: 'price'}
]
});
ds.loadData(myData);
var grid = new Ext.grid.GridPanel({
store: ds,
columns: [
{header: "Company", width: 120, dataIndex: 'company'},
{header: "Price", width: 90, dataIndex: 'price'}
],
renderTo: myDiv,
height: 180,
width: 900,
title: 'List of Packages'
});
I get this error :
Uncaught TypeError: Cannot read property 'dom' of null
Which is found at line 28211 in ext-all-debug. Code looks like this :
if (!me.container) {
me.container = Ext.get(me.el.dom.parentNode);
}
Anyone know what the issue is when i want to add a grid?
Also my index.html looks like this :
<script>
Ext.require([
'Ext.data.*',
'Ext.grid.*',
'Ext.tree.*'
]);
Ext.onReady (function () {
//application is built in here
});
</script>
Here's a fiddle :
https://fiddle.sencha.com/#fiddle/693
If I render to Ext.getBody() it works fine, but if i render to my own myDiv object it seems to have problems.
Ext.onReady
or inExt.application
? – Saki