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

Re: Where is the description of the "args" object passed to a subscribed event?

Expand Messages
  • bretlevy
    I know how to get the data from the cells of row, but I needed to know how to tell which of two (or more) buttons got clicked in a specific row (I knew which
    Message 1 of 7 , Sep 30, 2007
    • 0 Attachment
      I know how to get the data from the cells of row, but I needed to
      know how to tell which of two (or more) buttons got clicked in a
      specific row (I knew which row, but not which button)! I think the
      second example (getColumn) will tell me that!

      Thanks,
      ~~bret


      --- In ydn-javascript@yahoogroups.com, "Satyam" <satyam@...> wrote:
      >
      > Most often, you don't need any value from the button itself. If
      you do a:
      >
      > var record = this.getRecord(oArgs.target);
      >
      > You have all the information from the whole record for that row, so
      there is
      > no need to label or put any special tag to the button itself,
      whatever you
      > want you may get by doing:
      >
      > var someCrucialField = record.getData('keyOfCrucialField'); //
      usually the
      > database primary key
      >
      > Likewise, if you have more than one button on the same row in
      different
      > columns, doing:
      >
      > var column=this.getColumn(oArgs.target);
      >
      > will give you all the info you put into the column definitions
      including the
      > column.key property, which is the most useful to identify it.
      >
      > Actually, you don't even need to have an actual button on the cell,
      any
      > icon, text or whatever you want will serve. If you don't have a
      button, you
      > won't listen to buttonClickEvent but to cellClickEvent.
      >
      > Satyam
      >
      >
      >
      > ----- Original Message -----
      > From: "bretlevy" <bret@...>
      > To: <ydn-javascript@yahoogroups.com>
      > Sent: Sunday, September 30, 2007 7:46 PM
      > Subject: [ydn-javascript] Where is the description of the "args"
      object
      > passed to a subscribed event?
      >
      >
      > >
      > > I have a datatable that has a button on a row. I subscribed to
      the
      > > button click event as follows:
      > >
      > > myDataTable.subscribe ("buttonClickEvent", cmdProps_Click);
      > >
      > > And everything is cool, but now I have two different buttons on
      each
      > > row. I need to know what's "in" the "oArgs" argument passed to
      the
      > > event handler so I can tell which button was clicked. The columns
      > > have the formatter set to "button", so both columns call the same
      > > handler. There must be a way to "extract" something from the
      oArgs
      > > object that lets me tell which column/button got clicked on.
      > >
      > > Currently I am working around the problem by not formatting the
      > > columns as buttons and simply writing a <button> tag to the column
      > > with an onclick event that identifies which button got pressed,
      but
      > > that forces me to mix the inline javascript with the yui-based js,
      > > which I don't like.
      > >
      > > There must be docs on what's in that object somewhere, right?
      > >
      > > tx,
      > > ~~bret
      > >
      > >
      > >
      > >
      > >
      > > Yahoo! Groups Links
      > >
      > >
      > >
      > >
      > >
      > > --
      > > No virus found in this incoming message.
      > > Checked by AVG Free Edition.
      > > Version: 7.5.488 / Virus Database: 269.13.35/1039 - Release Date:
      > > 29/09/2007 21:46
      > >
      > >
      >
    • bretlevy
      Finding the column of the target and getting the key was the perfect solution! Thank you. I hated sticking onclick code into the contents of the table
      Message 2 of 7 , Sep 30, 2007
      • 0 Attachment
        Finding the "column" of the target and getting the key was the
        perfect solution! Thank you. I hated sticking "onclick" code into
        the contents of the table cell when everywhere else all event
        management is handled through the yui marshalling. I'm just picky
        that way...

        Thanks again. I guess if I studied long and hard enough through the
        docs I would have found the right path, but why read the docs when
        you can have someone point you in the right direction in 5
        minutes!!!! ;-)

        You guys are studs (and studesses).

        ~~bret

        PS: I actually did have just icons there first, but I like the
        buttons (with the icon on the button) so as to make it clear it is a
        clickable thingy versus just a piece of information (I have columns
        with little locks in them for example if the user is "locked out").


        --- In ydn-javascript@yahoogroups.com, "Satyam" <satyam@...> wrote:
        >
        > Most often, you don't need any value from the button itself. If
        you do a:
        >
        > var record = this.getRecord(oArgs.target);
        >
        > You have all the information from the whole record for that row, so
        there is
        > no need to label or put any special tag to the button itself,
        whatever you
        > want you may get by doing:
        >
        > var someCrucialField = record.getData('keyOfCrucialField'); //
        usually the
        > database primary key
        >
        > Likewise, if you have more than one button on the same row in
        different
        > columns, doing:
        >
        > var column=this.getColumn(oArgs.target);
        >
        > will give you all the info you put into the column definitions
        including the
        > column.key property, which is the most useful to identify it.
        >
        > Actually, you don't even need to have an actual button on the cell,
        any
        > icon, text or whatever you want will serve. If you don't have a
        button, you
        > won't listen to buttonClickEvent but to cellClickEvent.
        >
        > Satyam
        >
        >
        >
        > ----- Original Message -----
        > From: "bretlevy" <bret@...>
        > To: <ydn-javascript@yahoogroups.com>
        > Sent: Sunday, September 30, 2007 7:46 PM
        > Subject: [ydn-javascript] Where is the description of the "args"
        object
        > passed to a subscribed event?
        >
        >
        > >
        > > I have a datatable that has a button on a row. I subscribed to
        the
        > > button click event as follows:
        > >
        > > myDataTable.subscribe ("buttonClickEvent", cmdProps_Click);
        > >
        > > And everything is cool, but now I have two different buttons on
        each
        > > row. I need to know what's "in" the "oArgs" argument passed to
        the
        > > event handler so I can tell which button was clicked. The columns
        > > have the formatter set to "button", so both columns call the same
        > > handler. There must be a way to "extract" something from the
        oArgs
        > > object that lets me tell which column/button got clicked on.
        > >
        > > Currently I am working around the problem by not formatting the
        > > columns as buttons and simply writing a <button> tag to the column
        > > with an onclick event that identifies which button got pressed,
        but
        > > that forces me to mix the inline javascript with the yui-based js,
        > > which I don't like.
        > >
        > > There must be docs on what's in that object somewhere, right?
        > >
        > > tx,
        > > ~~bret
        > >
        > >
        > >
        > >
        > >
        > > Yahoo! Groups Links
        > >
        > >
        > >
        > >
        > >
        > > --
        > > No virus found in this incoming message.
        > > Checked by AVG Free Edition.
        > > Version: 7.5.488 / Virus Database: 269.13.35/1039 - Release Date:
        > > 29/09/2007 21:46
        > >
        > >
        >
      • Satyam
        ... From: bretlevy To: Sent: Monday, October 01, 2007 2:33 AM Subject: [ydn-javascript] Worked
        Message 3 of 7 , Oct 1, 2007
        • 0 Attachment
          ----- Original Message -----
          From: "bretlevy" <bret@...>
          To: <ydn-javascript@yahoogroups.com>
          Sent: Monday, October 01, 2007 2:33 AM
          Subject: [ydn-javascript] Worked perfectly! THX

          > but why read the docs when
          > you can have someone point you in the right direction in 5
          > minutes!!!! ;-)
          >

          Probably because the people who did take the time to read the manuals will
          eventually get tired and reply to you with a "RTFM".
        • bretlevy
          I was just kidding of course... ~~bret ... manuals will
          Message 4 of 7 , Oct 1, 2007
          • 0 Attachment
            I was just kidding of course...

            ~~bret


            --- In ydn-javascript@yahoogroups.com, "Satyam" <satyam@...> wrote:
            >
            >
            > ----- Original Message -----
            > From: "bretlevy" <bret@...>
            > To: <ydn-javascript@yahoogroups.com>
            > Sent: Monday, October 01, 2007 2:33 AM
            > Subject: [ydn-javascript] Worked perfectly! THX
            >
            > > but why read the docs when
            > > you can have someone point you in the right direction in 5
            > > minutes!!!! ;-)
            > >
            >
            > Probably because the people who did take the time to read the
            manuals will
            > eventually get tired and reply to you with a "RTFM".
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.