Hi,
Am 06.12.2006 um 13:09 schrieb Til Schneider:
> @Andreas Junghans: As far as I know, you are using links in a
> table. Can
> you post a small example to the list?
I'm using a custom data cell renderer for that. The values (returned
by the table model) for links look like this:
{href: "javascript:void(0)",
text: "Do something",
onclick: "my.package.MyMainClass.getInstance().doSomething();"
// Don't use single quotes in here!
// (LinkDataCellRenderer doesn't like that.)
}
And the renderer looks like this:
/**
* A data cell renderer for links.
*/
qx.OO.defineClass("my.package.LinkDataCellRenderer",
qx.ui.table.AbstractDataCellRenderer,
function() {
qx.ui.table.AbstractDataCellRenderer.call(this);
});
// overridden
qx.Proto._getContentHtml = function(cellInfo) {
var value = cellInfo.value;
var onclick = value.onclick;
return "<a style='outline:none' href='" + value.href + "'" +
(onclick ? " onclick='" + onclick + "'" : "") +
">" + value.text + "</a>";
};
// overridden
qx.Proto.updateDataCellElement = function(cellInfo, cellElement) {
var value = cellInfo.value;
var linkElement = cellElement.firstChild;
if (linkElement) {
linkElement.firstChild.nodeValue = value.text;
linkElement.href = value.href;
if (value.onclick) {
linkElement.onclick = new Function(value.onclick);
} else {
linkElement.onclick = null;
}
} else {
cellElement.innerHTML = self._getContentHtml(cellInfo);
}
};
// overridden
qx.Proto._createContentHtml_array_join = function(cellInfo, htmlArr) {
htmlArr.push(self._getContentHtml(cellInfo));
};
Regards,
Andreas
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel