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

Re: [ydn-javascript] Re: panel/dialog event from inside datatable cell - is it possible?

Expand Messages
  • Satyam
    You can get any data from the record, such as the one you mention, but that doesn t tell you which one was clicked. If you want to discriminate in between
    Message 1 of 4 , Oct 31, 2007
    • 0 Attachment
      You can get any data from the record, such as the one you mention, but that
      doesn't tell you which one was clicked.

      If you want to discriminate in between several links in a single column,
      checking the Column.key value won't help. Then, instead of listening to
      cellClickEvent, use linkClickEvent. In ev.target.href you can read the link
      destination. Since that link won't actually be followed, you can put any
      value in it that can help you identify it (just make sure the value is valid
      for an href). Be sure to use:

      YAHOO.util.Event.stopEvent(ev.event);

      to actually prevent the link to be followed, if it is the one you want to
      trap.

      Satyam


      ----- Original Message -----
      From: "j.elventails" <j.elventails@...>
      To: <ydn-javascript@yahoogroups.com>
      Sent: Wednesday, October 31, 2007 9:08 PM
      Subject: [ydn-javascript] Re: panel/dialog event from inside datatable
      cell - is it possible?


      > Thanks Satyam,
      >
      > So if in one datacell I have 2 links,
      > will I be able to specifically have the event panel show for the
      > second link only?
      >
      > e.g. from the record, I can grab:
      > var link1= oRecord.getData("link1");
      > var link2= oRecord.getData("link2");
      >
      > and I want the panel to only open for link2..
      >
      > can that be achieved in what you proposed, or is it the whole
      > cell?
      >
      > to rephrase, does this distinguish between link1, and link2?
      > given that they're both in the same datacell/column.
      >
      >> if (col.key == 'someName') {
      >> myPanel.show();
      >> }
      >
      >
      >
      >> myDataTable.subscribe('cellClickEvent', function (ev) {
      >> var col = this.getColumn(ev.target);
      >> var record = this.getRecord(ev.target);
      >> if (col.key == 'someName') {
      >> myPanel.show();
      >> }
      >> });
      >
      > Thanks!
      >
      >
      >
      > --- In ydn-javascript@yahoogroups.com, "Satyam" <satyam@...> wrote:
      >>
      >> The best solution is to listen to mouse clicks anywhere withing the
      > cell, no
      >> matter what you put there. It doesn't need to contain a link or
      > anything
      >> special.
      >>
      >> You can do it with the following code:
      >>
      >> myDataTable.subscribe('cellClickEvent', function (ev) {
      >> var col = this.getColumn(ev.target);
      >> var record = this.getRecord(ev.target);
      >> if (col.key == 'someName') {
      >> myPanel.show();
      >> }
      >> });
      >>
      >> The key property of the column allows you to recognize the column
      > which was
      >> clicked, from the record you can retrieve any value (with getData())
      > from
      >> the record that was clicked.
      >>
      >> Satyam
      >>
      >> ----- Original Message -----
      >> From: "j.elventails" <j.elventails@...>
      >> To: <ydn-javascript@yahoogroups.com>
      >> Sent: Wednesday, October 31, 2007 7:22 PM
      >> Subject: [ydn-javascript] panel/dialog event from inside datatable
      > cell - is
      >> it possible?
      >>
      >>
      >> > Hi,
      >> >
      >> > I'm trying to add an element in my datatable cells which,
      >> > when clicked, would popup a panel/dialog.
      >> >
      >> > Is this possible?
      >> >
      >> > my current panel/dialog works fine - when I try to embed
      >> > the link (with id="XX") that would call the panel to open,
      >> > from within the datatable it doesn't seem to work.
      >> >
      >> > Any clues, advice?
      >> >
      >> > Can it be done with the current yui version?
      >> >
      >> > Thanks!
      >> >
      >> >
      >> >
      >> >
      >> >
      >> > Yahoo! Groups Links
      >> >
      >> >
      >> >
      >> >
      >> >
      >> > --
      >> > No virus found in this incoming message.
      >> > Checked by AVG Free Edition.
      >> > Version: 7.5.503 / Virus Database: 269.15.14/1100 - Release Date:
      >> > 30/10/2007 18:26
      >> >
      >> >
      >>
      >
      >
      >
      >
      >
      > Yahoo! Groups Links
      >
      >
      >
      >
      >
      > --
      > No virus found in this incoming message.
      > Checked by AVG Free Edition.
      > Version: 7.5.503 / Virus Database: 269.15.14/1100 - Release Date:
      > 30/10/2007 18:26
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.