Hi Jim,
I have also been trying to get table cells to respond to mouse events. I
couldn't get Andreas's example to work properly either, but I have found a
nasty workaround that you could use if your are really desperate.
I'm not saying this is nice code -- but it will at least get you cliking cells
:)
After you have created your table, you can override its setFocusedCell() method
so that whenever a cell comes into focus, you can check whether its value has a
_handleonclick method, and if it does, then invoke it.
Here's a simple example:
var table = new qx.ui.table.Table(tableModel);
with (table) {
// table initialisation
// use single select mode
getSelectionModel().setSelectionMode(
qx.ui.table.SelectionModel.SINGLE_SELECTION);
};
// Override setFocusedCell to handle onclick for the cell
table.setFocusedCell = function(col, row, scrollVisible)
{
// ----vvvv---- code from the overridden method ----vvvv----
if (!this.isEditing() && (col != this._focusedCol || row !=
this._focusedRow))
{
this._focusedCol = col;
this._focusedRow = row;
var scrollerArr = this._getPaneScrollerArr();
for (var i = 0; i < scrollerArr.length; i++) {
scrollerArr[i].setFocusedCell(col, row);
}
if (scrollVisible) {
this.scrollCellVisible(col, row);
}
}
// ----^^^^---- code from the overridden method ----^^^^----
// Now do some extra stuff
var model = this.getTableModel();
var value = model.getValue(col, row);
if (value._handleonclick != null) {
value._handleonclick();
}
Hope this helps,
Simon
----- Original Message ----
From: Jim Hunter <[EMAIL PROTECTED]>
To: qooxdoo Development <qooxdoo-devel@lists.sourceforge.net>
Sent: Friday, 8 December, 2006 8:35:54 AM
Subject: Re: [qooxdoo-devel] Table with embeded controls in the cell
Til,
I have tried everything that Andreas has suggested and was able to put a button
in a grid by creating a renderer, but I have not been able to get the click
event to work on a button or an A tag. With the button, you can see it being
clicked but the code attached to it does not execute. Any thoughts?
Also, it would be very nice to know what pieces need to be covered when
creating a renderer or a new cellEditor for the grid. What things need to be
handled, namely the change to the appearence. What about variable names, are
they set in stone or can we use our oen names? Which leads to the question "How
does an appearence interfear with the functionality of the control?" This seems
like unrelated code.
Is there a Wiki on creating custom renderers?
thanks,
Jim
On 12/7/06, Til Schneider <
[EMAIL PROTECTED]> wrote:> For performance reasons the table uses plain
HTML for cell rendering.
> Therefore it is not possible to place qooxdoo widgets in cells. But you
> may use a qooxdoo widget as cell editor (this is the widget that
> will be
> shown in the currently edited cell, which is possible by double-clicking
> a cell).
>
> That would be OK with me if I could stuff my own HTML into a cell, but
> I tried to put '<button>Hi there</button> into a cell and the tags were
> stripped off and just 'Hi there' was rendered. Is there a secret to
> actually placing my own HTML into a cell?
Yes. Write a cell renderer. That's what they are for.
-------------------------------------------------------------------------
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
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
-------------------------------------------------------------------------
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
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Send instant messages to your online friends http://au.messenger.yahoo.com
-------------------------------------------------------------------------
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
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel