:: Forum >> Version 2 >>

Tabs - load content and code with AW.HTTP.Request

Hi Alex, thanx to you, great job AW framework.

I have download Activewidget 2.0.2 and give it a try. You should remember this example on your Trial packet of version 2.0.2 (activewidgets-2.0.2-trial.zip\ActiveWidgets\examples\controls - tabs):

"Tabs - load content and code with AW.HTTP.Request, use onSelectedItemsChanged event and AW.HTTP.Request object to load content in Ajax-style, extract the script from the page and eval()"

I modify your code and try to populate data on grid by calling other php script using this scenario:
(this is the modification of page0.html on your example:)

var grid = new AW.UI.Grid;
    
grid.setId("myGrid");
    ...
    
grid.refresh();

    var 
html_doc document.getElementsByTagName('head').item(0);
    var 
js document.createElement('script');
    
js.setAttribute('language''javascript');
    
js.setAttribute('type''text/javascript');
    
js.setAttribute('src''loanlist.php?tipe=view&user_id='+<?=$_SESSION['user_id'];?>);
    
js.setAttribute('id''&noCacheIE=' + (new Date()).getTime());
    
html_doc.appendChild(js);
    
    function 
loanList(update){
        if (
update == null) {
            
alert('No Loan');
            
grid.setCellData("");
            
grid.refresh();
        }
        else {
            
grid.setCellData(update);
            
grid.refresh();
        }
    } 
The loanlist.php do the serialization from MySQL query results into two-dimensional javascript array. But....,it still result for Error "loanList is not defined". i use FF 1.5.0.7.

Thank you very much for your help.

Frans Raharjo
Saturday, March 17, 2007



This topic is archived.

Back to support forum

Forum search