including Active Widgets objects in Ajax response.
I suspect this is a REALLY stupid question but i need to ask it anyway.
Can anyone tell me what i need to do.
many thanks...oh, and sorry for the stupid question....
<script> tags are NOT evaluated when you insert them via innerHTML. To run the script you have to extract the script and execute it with eval() function. There is a sample code in /examples/controls-tabs/code.htm
if i do this it seems to overwrite the whole page - not put the content inside the target tag (a <div> in this case).
I have read elsewhere that document.write causes problems when included as part of an ajax response so maybe that is the problem.
You can only use document.write() while the page is loading. Otherwise it creates a new blank document instead of the current one. In your case you should either use el.innerHTML=obj or add placeholder element with the same id and then call obj.refresh() (again, see the sample code in /examples/controls-tabs/code.htm).
OK thanks - but to quote the example code for the combo widget....
obj.setItemText(['Home', 'Favorites', 'Font size', 'Search']);
obj.setItemImage(['home', 'favorites', 'fontsize', 'search']);
....i guess that means that active widgets cannot be included in any ajax response.
You can include AW objects into ajax response - just don't use document.write() method. Check the sample code in /examples/controls-tabs/code.htm.
Many thanks Alex. So in my ajax response buffer i should build up something like..
var names = ["Start", "Another page", "The last page"];
var values = ["page0.htm", "page2.htm", "page3.htm"];
var tabs = new AW.UI.Tabs;
tabs.setItemValue(values); // store page URLs in the 'value' property.
and lets say i want to put this tab object inside a table cell with an id of 'theTabs' - what should i do in my Ajax 'OnSuccess' event to achieve this ?
You should assign a different id to the table cell, for example, myTabsParent, and then instead of document.write(tabs) use
document.getElementById("myTabsParent").innerHTML = tabs;
you can insert a <span> into your html markup with the same id as your AW object and just call tabs.refresh();
I am not even doing creating AW widgets with AJAX response , I am just trying to create AW widgets after the page is loaded.
Even after refreshing every AW widget, I don't see the grid/buttons.
I just the text boxes and labels only
This topic is archived.
Back to support forum