View Full Version : XTemplate - div tag issue

8 Apr 2008, 5:38 AM
Hi to all,
Im using XTemplate class and everything working fine, but one thing I can not understand why its making problem during rendering template.

Template line is:

html += '<table border="0" style="margin:20px !important; margin-top:5px !important;" cellpadding="0"><tr><td><img src="{imgsrc}" border="1" alt=""/><div id="chartId"></div></td></tr></table>';

Ext code is (part):

var templateStruct = new Ext.XTemplate(html);
var decodedJson = Ext.util.JSON.decode(response.responseText);
document.getElementById('right').innerHTML = templateStruct.applyTemplate(decodedJson);

When I check dynamic generated code with Firebug I can see that div tag isn't complete, not closed!!!

<table cellpadding="0" border="0" style="margin: 5px 20px 20px ! important;">
<img id="ext-gen78" border="1" alt="" src="bin/class/chart/class.graphic.php?title=Printer+usage&axis_x=Type&axis_y=Total&type=2&skin=1&graphic_1=&graphic_2=&credits=0&x0=101&y0=256845&x1=407&y1=565&x2=408&y2=22223&x3=403&y3=7956&x4=404&y4=101340&x5=501&y5=56565"/>
<div id="chartId"/>

I need this div tag to plot one bar chart using JQuery Flot lib. I've tested Flot at other example at my local and it is functional. Just in this case i can not get Flot chart printed out at front end.

Please, any one can help me!?

Best regards,

8 Apr 2008, 5:55 AM
I've checked again in Firebug this div tag when it has set sone innerHTML value. Then it is ok shown :) my mistake but again I can not get bar chart at front end in that div tag?!

Does any one has some more complicated example with XTemplate and JQuery Flot?

8 Apr 2008, 6:20 AM
I don't know of an example, however the div tag is closed, the / at the end is a way of closing a tag when there is no content in that tag. So that is okay.

As far as your section post, I don't understand what you are asking or wanting.