:: Forum >> Version 1 >>
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
Sunday, July 31, 2005
anyone could help me ? :)
Greg
Monday, August 1, 2005
Try this:
replace :
$html .= "obj.setColumnTemplate(new Active.Templates.Image,0);";
with :
$html.="var myimage = new Active.Templates.Image;
.......
obj.setColumnTemplate(myimage ,0);";
Monday, August 1, 2005
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
Monday, August 1, 2005
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
Monday, August 1, 2005
$html .= "obj.setDataProperty(\"image\",function(i, 0){return ".$name."_data[i][23]});";
// function(i, 0) -- just for zero column
Tuesday, August 2, 2005
This doesnt work it says it is waiting for an object
Greg
Tuesday, August 2, 2005
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
Tuesday, August 2, 2005
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
Tuesday, August 2, 2005
This topic is archived.
Back to support forum
Forum search