3.0 beta 2

Problem Link/image

Hi,

In my active widget i apply firt an image template that works to the first column (0) and after i apply a link template to the column 2.

But when i apply the link template, it also applies the image template to the column 2 at the same time so i also have the image to the column 2 and i don't want.

Any idéa or help ?

My code :

$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";
    $html .= "obj.setDataProperty(\"image\",function(i, j){return ".$name."_data[i][23]});";
    $html .= "obj.setColumnTemplate(new Active.Templates.Image,0);";
    $html .= "obj.setStatusProperty(\"code\", \"loading\");"; 
    $html.="var link = new Active.Templates.Link; 
    link.setAttribute(\"target\",\"principal\"); 
    link.setAttribute(\"href\",function() { return \"../page_principale.php?page=105&id_livraison=\" + this.getItemProperty(\"value\");}); 
    obj.setColumnTemplate(link,2); 
    ";
    $html .= "  document.write($name);\n";
    $html .= "}\n";
    $html .= "catch (error){\n";
    $html .= "  document.write(error.description);\n";
    $html .= "}\n";
    $html .="obj.setStatusProperty(\"code\", \"\");obj.refresh();"; 
    $html .= "</"."script".">\n";



Thanks,

Greg
Greg
July 31,
anyone could help me ? :)
Greg
August 1,
Try this:
replace :
$html .= "obj.setColumnTemplate(new Active.Templates.Image,0);";

with :
$html.="var myimage = new Active.Templates.Image; 
.......
obj.setColumnTemplate(myimage ,0);";
August 1,
it seems not to work since the grid doesnt display at all when i replaced like this :

$html.=  "var myimage = new Active.Templates.Image"; 
    $html .= "obj.setDataProperty(\"image\",function(i, j){return ".$name."_data[i][23]});";
    $html .= "obj.setColumnTemplate(myimage,0)";
    $html .= "obj.setStatusProperty(\"code\", \"loading\");"; 
    $html.="var link = new Active.Templates.Link; 
    link.setAttribute(\"target\",\"principal\"); 
    link.setAttribute(\"href\",function() { return \"../page_principale.php?page=105&id_livraison=\" + this.getItemProperty(\"value\");}); 
    obj.setColumnTemplate(link,2);";
Greg
August 1,
oops sorry that works i forgot a ; but this does the same thing like before (applying the image to the column with the link in addition of the column 0)

Any idea ? because i didn't find
Greg
August 1,
$html .= "obj.setDataProperty(\"image\",function(i, 0){return ".$name."_data[i][23]});"; 
// function(i, 0) -- just for zero column

August 2,
This doesnt work it says it is waiting for an object
Greg
August 2,
However, I think the error is in

$html .= "obj.setDataProperty(\"image\",function(i,j){return ".$name."_data[i][23]});";

because when i comment this line :

$html .= "obj.setColumnTemplate(myimage,0)";

The template still applies ( and only applies) to column 2 (the one with the links).

Any other method ?
Greg
August 2,
I found a workaround

$html .= "obj.setDataProperty(\"image\",function(i,j){if(j!=0) return 0; else return ".$name."_data[i][23]});";

thanks anyway;)
Greg
August 2,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.