:: Forum >> Version 1 >>

Use with PHP and ChartDirector

More information on this topic is available in the documentation section: /active.howto/.

Hi,

i am using chart director objects in a php script to plot a bar graph, using 2 data sets.

this same data i want to present in the form of a scrollable table using active widgets.

the data is available in the form of php arrays.

any idea how i can integrate active widgets code in my php script to present the data in table format.

please help soon.

-Amey Pethe.
Amey Pethe
Tuesday, May 17, 2005
<html>
<
head>
    <
title>ActiveWidgets Grid :: Examples</title>
    <
stylebodyhtml {margin:0pxpadding0pxoverflowhidden;} </style>

    <!-- 
ActiveWidgets stylesheet and scripts -->
    <
link href="./grid.css" rel="stylesheet" type="text/css" ></link>
    <
script src="./grid.js"></script>

    <!-- 
grid format -->
    <
style>
        .
active-controls-grid {height100%; fontmenu;}
        .
active-column-{width:  80px;}
        .
active-column-{width200px;}
        .
active-column-{text-alignright;}
        .
active-grid-column {border-right1px solid threedlightshadow;}
        .
active-grid-row {border-bottom1px solid threedlightshadow;}
    </
style>
    <!-- 
grid data -->
    <
script>
var 
myData = new Array();
<
?
$name 
= array("c","cc""ccc");
$sql "SELECT c , cc, ccc  FROM table1";
$stmt=ociparse($con,$sql);
ociexecute($stmt);
OCIFetchStatement($stmt,$row,0,-1,OCI_FETCHSTATEMENT_BY_ROW);
    foreach(
$row as $key=>$value){
        echo 
"myData.push([";
        foreach (
$name as $k1=>$v1){
        echo 
"\"".$value[$v1]."\",";
        }
        echo 
" ]);";
    }
?>        
var 
myColumns = [
            
"Ticker""Company Name""Market Cap."
        
];
</
script>
</
head>
<
body>
    <
script>
    
//    create ActiveWidgets Grid javascript object
    
var obj = new Active.Controls.Grid;

    
//    set number of rows/columns
    
obj.setRowProperty("count"20);
    
obj.setColumnProperty("count"3);

    
//    provide cells and headers text
    
obj.setDataProperty("text", function(ij){return myData[i][j]});
    
obj.setColumnProperty("text", function(i){return myColumns[i]});

    
//    set headers width/height
    
obj.setRowHeaderWidth("28px");
    
obj.setColumnHeaderHeight("20px");

    
//    set click action handler
    
obj.setAction("click", function(src){window.status src.getItemProperty("text")});

var 
row obj.getTemplate("row");
row.setEvent("onkeydown",function(){this.action("myAction")});
obj.setAction("myAction",function(src){
                                                        
alert();
                                                        });
obj.setProperty("selection/index"0);                                                         
    
document.write(obj);
obj.refresh();
obj.element().focus();
    </
script>
</
body>
</
html>
 
hope it helps...
hob
Monday, May 23, 2005
hi hob,

thanks for your help, i'll see if it works.
Tuesday, May 24, 2005



This topic is archived.

Back to /active.howto/

Documentation:

Forum search