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

Re: tbodyKeyEvent and using "Enter" to show the cell editor

Expand Messages
  • Levi
    Thanks, Satyam. I will give this a try. To fix it for the time being, I used prototype s defer method to let the call stack empty before executing. This
    Message 1 of 4 , Jan 1, 2009
    • 0 Attachment
      Thanks, Satyam. I will give this a try. To fix it for the time
      being, I used prototype's "defer" method to let the call stack empty
      before executing. This seems to let the event go completely through,
      and then the Cell Editor does not immediately receive the keydown event.

      --- In ydn-javascript@yahoogroups.com, Satyam <satyam@...> wrote:
      >
      > Try using YAHOO.util.Event.preventDefault(args.event);
      >
      > Satyam
      >
      >
      > Levi wrote:
      > > I am trying to have the "Enter" key initiate the inline cell editor
      > > depending on which cell is currently active. The problem that I am
      > > having (it seems) is that when I respond to the tbodyKeyEvent and show
      > > the cell editor, it immediately disappears. I think what is happening
      > > is that the keyboard event is being propagated still, so when the
      > > editor comes up, it immediately gets the keyboard event and initiates
      > > the "Save". It works if I use another key to bring up the cell editor
      > > (such as F2). I guess my question is about whether or not I can
      > > prevent this behavior. Please let me know if there is any further
      > > information that I can provide. Thanks in advance.
      > >
      > > Levi
      > >
      > > here is some pseudo-code:
      > >
      > > ontbodyKeyEvent = function(args) {
      > > var code = (args.event.charCode || args.event.keyCode),
      > > cell = this.getLastSelectedCell();
      > >
      > > if( !cell ) return true;
      > >
      > > switch(code)
      > > {
      > > //case 113: <-- works if I use "F2" or something
      > > case 13:
      > > {
      > > this.showCellEditor(this.getTdEl(cell));
      > > }
      > > break;
      > > default: break;
      > > }
      > >
      > > return false;
      > > };
      > >
      > > dt.subscribe('tbodyKeyEvent',ontbodyKeyEvent);
      > >
      > >
      > > ------------------------------------
      > >
      > > Yahoo! Groups Links
      > >
      > >
      > >
      > >
      ------------------------------------------------------------------------
      > >
      > >
      > > No virus found in this incoming message.
      > > Checked by AVG - http://www.avg.com
      > > Version: 8.0.176 / Virus Database: 270.10.1/1870 - Release Date:
      31/12/2008 8:44
      > >
      > >
      >
    • Scott Youmans
      Levi, Can you explain what you mean by using the prototype s defer method? Satyam, i ve used preventDefault, stopPropagation and stopEvent to noavail inside my
      Message 2 of 4 , May 13, 2009
      • 0 Attachment
        Levi, Can you explain what you mean by using the prototype's defer method?

        Satyam, i've used preventDefault, stopPropagation and stopEvent to noavail inside my tbodyKeyEvent callback. Any other suggestions?

        I'm using YUI 2.7

        Thanks, Scott

        --- In ydn-javascript@yahoogroups.com, "Levi" <skankwilsonite@...> wrote:
        >
        > Thanks, Satyam. I will give this a try. To fix it for the time
        > being, I used prototype's "defer" method to let the call stack empty
        > before executing. This seems to let the event go completely through,
        > and then the Cell Editor does not immediately receive the keydown event.
        >
        > --- In ydn-javascript@yahoogroups.com, Satyam <satyam@> wrote:
        > >
        > > Try using YAHOO.util.Event.preventDefault(args.event);
        > >
        > > Satyam
      Your message has been successfully submitted and would be delivered to recipients shortly.