Dojo Widgets not rendering when returned in response to XhrPost
Posted
by lazynerd
on Stack Overflow
See other posts from Stack Overflow
or by lazynerd
Published on 2010-04-09T11:39:43Z
Indexed on
2010/04/09
11:43 UTC
Read the original article
Hit count: 389
I am trying to capture the selected item in a Dijit Tree widget to render remaining part of the web page. Here is the code that captures the selected item and sends it to Django backend:
<div dojoType="dijit.Tree" id="leftTree" store="leftTreeStore" childrenAttr="folders" query="{type:'folder'}" label="Explorer">
<script type="dojo/method" event="onClick" args="item">
alert("Execute of node " + termStore.getLabel(item));
var xhrArgs = {
url: "/load-the-center-part-of-page",
handleAs: "text",
postData: dojo.toJson(leftTreeStore.getLabel(item), true),
load: function(data) {
dojo.byId("centerPane").innerHTML = data;
//window.location = data;
},
error: function(error) {
dojo.byId("centerPane").innerHTML = "<p>Error in loading...</p>";
}
}
dojo.byId("centerPane").innerHTML = "<p>Loading...</p>";
var deferred = dojo.xhrPost(xhrArgs);
</script>
</div>
The remaining part of the page contains HTML code with dojo widgets. This is the code sent back as 'response' to the select item event. Here is a snippet:
<div dojoType="dijit.layout.TabContainer" id="tabs" jsId="tabs">
<div dojoType="dijit.layout.BorderContainer" title="Dashboard">
<div dojoType="dijit.layout.ContentPane" region="bottom">
first tab
</div>
</div>
<div dojoType="dijit.layout.BorderContainer" title="Compare">
<div dojoType="dijit.layout.ContentPane" region="bottom">
Second Tab
</div>
</div>
</div>
It renders this html 'response' but without the dojo widgets. Is handleAs: "text" in XhrPost the culprit here?
© Stack Overflow or respective owner