Loading ...
Sorry, an error occurred while loading the content.

which cell in datatable clicked?

Expand Messages
  • Todd Wells
    I have a column in my datatable that contains a checkbox in each cell. Basically I m allowing the user to check boxes to indicate which rows they want to
    Message 1 of 2 , Dec 5, 2008
    • 0 Attachment
      I have a column in my datatable that contains a checkbox in each cell.  Basically I'm allowing the user to check boxes to indicate which rows they want to batch-apply certain values to.

      Either via the click event on the checkbox or the click event on the cell, I'd like to know which record the cell corresponds to.  How can I do that?  I've been looking at the events in firebug and the api and nothing stands out.

      For part B (the bonus round), it would be great to be able to preserve checkbox state between table pagination.  The checkbox state is not stored on the server or returned by the dynamic data that the datatable is wired to.  As it is now, if a checkbox in a cell is check and the user navigates to a different page in the recordset, the checkbox state on the previous page is lost.  I was thinking the thing to do was to intercept the click event (on the checkbox or cell), determine what data record that corresponds to, and then store the checkbox state in the datarecord and look for that state when that cell is rendered when returning to the page.  Maybe there's a simpler approach, I'd love to hear it.

    • Satyam
      This example might help: http://www.satyam.com.ar/yui/2.6.0/deleteRowsBy.html As for part B, you might want to keep an array or hash keyed by some unique row
      Message 2 of 2 , Dec 6, 2008
      • 0 Attachment
        This example might help:

        http://www.satyam.com.ar/yui/2.6.0/deleteRowsBy.html

        As for part B, you might want to keep an array or hash keyed by some
        unique row identifier marking the rows that have been selected and
        updated which every click. You then serialize this array via JSON and
        store it in a cookie. Whenever you reach this page you check for the
        existence of that cookie and set the checkboxes on the DataTable by it.

        Satyam


        Todd Wells wrote:
        > I have a column in my datatable that contains a checkbox in each
        > cell. Basically I'm allowing the user to check boxes to indicate
        > which rows they want to batch-apply certain values to.
        >
        > Either via the click event on the checkbox or the click event on the
        > cell, I'd like to know which record the cell corresponds to. How can
        > I do that? I've been looking at the events in firebug and the api and
        > nothing stands out.
        >
        > For part B (the bonus round), it would be great to be able to preserve
        > checkbox state between table pagination. The checkbox state is /not/
        > stored on the server or returned by the dynamic data that the
        > datatable is wired to. As it is now, if a checkbox in a cell is check
        > and the user navigates to a different page in the recordset, the
        > checkbox state on the previous page is lost. I was thinking the thing
        > to do was to intercept the click event (on the checkbox or cell),
        > determine what data record that corresponds to, and then store the
        > checkbox state in the datarecord and look for that state when that
        > cell is rendered when returning to the page. Maybe there's a simpler
        > approach, I'd love to hear it.
        >
        >
        > ------------------------------------------------------------------------
        >
        >
        > No virus found in this incoming message.
        > Checked by AVG - http://www.avg.com
        > Version: 8.0.176 / Virus Database: 270.9.14/1832 - Release Date: 05/12/2008 9:57
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.