Re: datagrid and JavaScript events
| From: | Mark Wiesemann | Date: | Sun, 26 Aug 2007 21:26:24 +0000 |
| Subject: | Re: datagrid and JavaScript events | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-27853@lists.php.net to get a copy of this message | ||
Hi Michael,
Michael Tadmor wrote:
> I have a question regarding the datagrid structure.
> I want to use javascript events on the datagarid cells (specifacally on
> rows), for example, I want that a click on each row will change a value on
> my page according to the specific row i clicked on (or to highlight a row
> when the curser is hovering over it). is it possible using the datagrid? if
> so, how can I do it?
SDG only allows you to add e.g. 'onclick' events to columns. This
wouldn't help you; also because you don't have access to the value or
the row number.
The right solution would be to overload the HTML_Table renderer, and to
modify the behaviour of the buildRow() method. You could add an
'onclick' event there, e.g. calling a JS function, including a value
from the currently generated row.
BTW, simple hovering markers can be added without overloading. There is
a nice little JavaScript file namend zebra.js somewhere on the web that
adds this behaviour to the <tbody> part(s) of tables.
Regards,
Mark
--
http://www.markwiesemann.eu