PDA

View Full Version : How to render a complex table (tree)?



MichaelEr
18 Feb 2012, 10:22 AM
Hi together,
I want to render the content of a TreeStore but not with the default Tree implementation. A rendered tree node must result in a complex <div> structure. Also the first element of the children should be rendered in the same row as the parent node, so the tree is more horizontal. Also different node types should be rendered diffrently. To realize this I want to build up the tree programmatically, not via configuration. Each node type should be a custom component which are assembled to a tree. But I stuck at the simplest level, creating a simple table. When The following snippet is rendered, I get the following error:
el is null
AT: ieTable(depth=4, s="<table><tbody><tr>", h="<div id="component-1063"></div>", e="</tr></tbody></table>")
Instructions:

var tableElement = Ext.widget('container', {
autoEl : 'table'
});
var rowElement = Ext.widget('container', {
autoEl : 'tr'
});
tableElement.add(rowElement);
var cellElement = Ext.widget('container', {
autoEl : 'td'
});
rowElement.add(cellElement);
var cellContent = Ext.widget('component', {
html : 'Hello world!'
});
cellElement.add(cellContent);
panel.add(tableElement);

The rendered content:
31878

Why is there a second row? Or did I failed completely? Wrong concept - idea?

Better ideas to realize this?

Kind regards
Michael

MichaelEr
19 Feb 2012, 2:50 AM
I also tried it with custom components and overriding the onRender methods with:

onRender : function(ct) {
this.el = ct.createChild({
cls : 'simple-table',
tag : 'table'
});
this.callParent(arguments);
},
getTargetEl : function(){
return this.el;
}
But also there I got an error when rendering and a row I never added to my structure. Also the tbody is contained, which I never added. How to disable this behaviour?

Rendered:
31892

Kind Regrads
Michael

MichaelEr
21 Feb 2012, 7:33 AM
Hi, sorry for that push, but I didn't found yet a solution for creating a table based container. Is there an interface which I have to fulfill? I always run into this specific table behaviour where there is a tag name filtering for tr,td,table tags which ends up with an exception.

Kind regards
Michael