expand a row when it is clicked to display details[2]
here a little expansion code for rows:
to see how it works: http://webmail.mbn.ch/table/dyntable.php
unfortunately i was not able to add double and single click, so the spreadsheet editor does not work at the same time.
Instead of
you may use
to insert extra data from outside
var expandColumn = 1; // the column to copy in the expanded part
var expandHeight = "70px"; // the height of the expanded part
function expandFunction (src) {
var id = this.getId()
var row = src.getProperty("item/index")
expandRow(this.getId() , src.element().id, src.getProperty("item/index"), expandColumn, expandHeight, myData);
}
//****************************
function expandRow(id, rowid, row, column, height, data){
var expa = document.getElementById(rowid);
if(expa.getAttribute("openRow")=="1"){ // shrink
expa.setAttribute("openRow","0");
expa.style.height = "";
expa.removeChild(document.getElementById("exp_"+row));
}else{ // expand
expa.setAttribute("openRow","1");
expa.style.height = "auto";
var pX = document.createElement("DIV");
pX.id = "exp_"+row;
pX.innerHTML = data[row][column]+"<br>additional<br>blabla<br><br>blabla<br>blabla<br>blabla<br>blabla"; // the data
// either assigning a pX.className = "" or the hard way:
pX.style.border = "solid 1px #DDDDDD";
pX.style.overflow = "auto";
pX.style.width = "400px";
pX.style.height = height;
pX.style.marginLeft = "10px";
expa.appendChild(pX);
}
document.getElementById(id+".left.item:"+row).style.height = expa.offsetHeight;
}
//****************************
var row = new Active.Templates.Row;
row.setEvent("onclick", function(){this.action("expandAction")});
obj.setTemplate("row", row);
obj.setAction("expandAction", expandFunction);
to see how it works: http://webmail.mbn.ch/table/dyntable.php
unfortunately i was not able to add double and single click, so the spreadsheet editor does not work at the same time.
Instead of
var pX = document.createElement("DIV");
you may use
var pX = document.createElement("IFRAME");
pX.setAttribute("src", "extradata.php?row="+row);
to insert extra data from outside
Andres Obrero [Winterthur]
March 14,