3.0.5

may i ask a naive question?

I saw many solutions in this wonderful forum. Many of them consist of the following lines:

var obj = new Active.Controls.Grid;
obj.setProperty("column/count", 5);

or var obj = Active.Controls.Grid;

May I know where should I insert the code regarding this 'obj'? Currently I am writing php and also mess up with javascript. Do I need to modify the activewidgets.php ? or in the basic.php?

Thanks a lot !


absolutely newbie
April 1,
I am not using php, just pure HTML with JavaScript, but from looking at the two examples in the distribution:

basic.php is an example for a HTML page that uses the activewidgets.php per the include:

<!-- ActiveWidgets PHP functions -->
    <?php include("activewidgets.php") ?>


activewidgets.php is an example how to externalize the most activewidgets coding into an file that then can be included (see above).

Regarding the obj question:

In activewidgets.php look for function activewidgets_grid: where ever you see $name you can substitute it in your mind with obj. The obj is created at the beginning of the code and passed to that function.

Hope that helped.
Andreas
April 1,
Thanks a lot!

I add the following lines in activewidgets.php to enable the onclick event and popup an alert. However, I have not seen any effects. Am I wrong at some points? thanks

$html = "<"."script".">\n";
$html .= $columns;
$html .= $rows;
$html .= "try {\n";
$html .= " var $name = new Active.Controls.Grid;\n";
$html .= " $name.setRowCount($row_count);\n";
$html .= " $name.setColumnCount($column_count);\n";
$html .= " $name.setDataText(function(i, j){return ".$name."_data[i][j]});\n";
$html .= " $name.setColumnText(function(i){return ".$name."_columns[i]});\n";

$r = "row";
$src = "src";

$html .= " var $r = $name.getTemplate(\"row\");\n";
$html .= " $r.setEvent(\"onclick\", function(){this.action(\"myAction\")});\n";
$html .= " $name.setTemplate(\"row\", $r);\n";
$html .= " $name.setAction(\"myAction\", function($src){alert($src.getProperty(\"item\/index\"))});\n";

$html .= " document.write($name);\n";
$html .= "}\n";
$html .= "catch (error){\n";
$html .= " document.write(error.description);\n";
$html .= "}\n";
$html .= "</"."script".">\n";
absolutely newbie
April 2,
Hi,

I am using php too, I could resolve the onlcick event by adding this line to the code.

In my case I open a new window, if you want to display an alert change where it says window.open... and write your javascript code.

$html .= " $name.setEvent('onclick', function(){window.open('url','mywindow','width=300,height=300, resizable=no, left=600');})\n";

Now I'm trying to restrict it to only fire the event when one cell is clicked and not everyplace in the row

Nano
June 29,

This topic is archived.

See also:


Back to support forum