[ 4 posts ]

rolfsf

  • Username: rolfsf
  • Joined: Mon Mar 16, 2009 8:29 am
  • Posts: 29
  • Offline
  • Profile

expandable rows and cellMouseoverEvent

Post Posted: Thu May 19, 2011 3:15 pm
+0-
Is there a way to use the cellMouseoverEvent to highlight a cell in a table inside an expandable row?

http://developer.yahoo.com/yui/examples ... basic.html

I'm trying to use the datatable's built in events to handle some things inside the expanded rows, but I'm unsure how to do that. The basic structure we're using inside the expandable rows is:

Code:
<tr class="yui-dt-expansion">
  <td colspan="12" class="">
    <div class="yui-dt-liner">
      <table>
        <thead><tr><th>header</th><th>header</th></tr></thead>
        <tbody><tr><td>data</td>data<td></td></tr></tbody>
      </table>
    </div>
  </td>
</tr>

Todd Smith

YUI Contributor

  • Username: stlsmiths
  • Joined: Thu Nov 05, 2009 10:03 am
  • Posts: 675
  • GitHub: stlsmiths
  • Gists: stlsmiths
  • IRC: t_smith
  • Offline
  • Profile

Re: expandable rows and cellMouseoverEvent

Post Posted: Thu May 19, 2011 8:18 pm
+0-
You haven't provided any details about how you insert the sub-table in the expanded rows. If you just insert an additional HTML Table element as you indicated it won't have any granularity of DataTable capability because it is simply an HTML DOM Table. You could do it by defining unique DOM "id"s to elements and then adding a bunch of listeners, but that would be cumbersome and prone to memory leaks.

If you really want to embed a sub-table as a YUI DataTable within a parent DataTable, I suggest you review Satyam's example. http://www.satyam.com.ar/yui/2.8.0/nested1.html

His approach inserts a DataTable within the expansion row of the parent Table (call it a child table). The child table is a true YUI DataTable with all the API capability available to do as you please.

Hope it works for you,
Todd

rolfsf

  • Username: rolfsf
  • Joined: Mon Mar 16, 2009 8:29 am
  • Posts: 29
  • Offline
  • Profile

Re: expandable rows and cellMouseoverEvent

Post Posted: Wed Jun 01, 2011 1:36 pm
+0-
thanks for the reply

no, the subrow tables are not built as yui datatables - they're built much the way the original expandable rows table is built, using YAHOO.lang.substitute( row_template, item, processor );

So again, is there a way to harness the yui datatable events such as cellMouseoverEvent for elements within a subrow, or can I use yui.event.delegate to augment the datatable's own event listeners?

Todd Smith

YUI Contributor

  • Username: stlsmiths
  • Joined: Thu Nov 05, 2009 10:03 am
  • Posts: 675
  • GitHub: stlsmiths
  • Gists: stlsmiths
  • IRC: t_smith
  • Offline
  • Profile

Re: expandable rows and cellMouseoverEvent

Post Posted: Wed Jun 01, 2011 5:02 pm
+0-
The lowest level of element that you can get to with DataTable events is cell level (cellMouseoverEvent, etc...). The target returned from this event is the DIV liner in the TD element. You might be able to set a delegate on elements within a subrow (i.e. within the DIV inside TD), but you will need to come up with a method to define unique ID's or class names to use to distinguish which one is the target.
  [ 4 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum