lkasdorf
6 Jul 2007, 7:51 AM
Perhaps someone can share a wee bit on insight on something that I'm having trouble grokking with Ext. I am very new to Ext, but quite experienced with js, ajax, dojo, mybic, etc.
I have worked through most of the tutorials, and have a decent understanding, and have begun converting a project over to ext. I am able to use the UpdateManager to call a php script, which gets some data and returns html. The problem I have is that UpdateManager seems geared toward directly populating the innerHTML of a div, and I don't always want to do that. Instead, I want to call a callback function, and deal with the response data (JSON) myself.
Example:
// display list of organizations
function displayOrgList()
{
var mgr = new Ext.UpdateManager('orgListDiv');
mgr.update("scripts/displayOrgList.php", "foo=bar", displayOrgListCb);
}
// this gets called, and oResponse contains whatever the php script returns
// but my 'orgListDiv' gets stuffed with the response- I don't want that!
function displayOrgListCb(oElement, bSuccess, oResponse)
{
alert("displayOrgListCb");
}
This works fine except that my 'orgListDiv' gets populated with the return data of my server script, and I don't want this in many situations.
UpdateManager is a member of the element object, so it is inherently tied to some element. Perhaps I just need to create a dummy element that is invisible, but this seems inelegant.
I have been searching the docs and forums and I know that what I want is obviously possible (since there is a lot of talk about using JSON- and you wouldn't stick JSON into innerHTML), but I've not yet seen how to suppress this.
I have worked through most of the tutorials, and have a decent understanding, and have begun converting a project over to ext. I am able to use the UpdateManager to call a php script, which gets some data and returns html. The problem I have is that UpdateManager seems geared toward directly populating the innerHTML of a div, and I don't always want to do that. Instead, I want to call a callback function, and deal with the response data (JSON) myself.
Example:
// display list of organizations
function displayOrgList()
{
var mgr = new Ext.UpdateManager('orgListDiv');
mgr.update("scripts/displayOrgList.php", "foo=bar", displayOrgListCb);
}
// this gets called, and oResponse contains whatever the php script returns
// but my 'orgListDiv' gets stuffed with the response- I don't want that!
function displayOrgListCb(oElement, bSuccess, oResponse)
{
alert("displayOrgListCb");
}
This works fine except that my 'orgListDiv' gets populated with the return data of my server script, and I don't want this in many situations.
UpdateManager is a member of the element object, so it is inherently tied to some element. Perhaps I just need to create a dummy element that is invisible, but this seems inelegant.
I have been searching the docs and forums and I know that what I want is obviously possible (since there is a lot of talk about using JSON- and you wouldn't stick JSON into innerHTML), but I've not yet seen how to suppress this.