Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ListGridField of type DateItem with KeyPressHandler

    Hi,

    On a custom formitem which extends DateItem, I add a KeyPressHandler which reacts to UP & DOWN keys.
    In a DynamicForm, this works fine and behavior is as expected.

    When I use this formitem in a ListGrid as editor, the UP & DOWN keys are ignored by the formitem and are interpreted by the ListGrid as "go to the next/previous row". This is good behavior I don't want to remove.

    In the showcase I saw it works as expected for a normal item which has a ValueMap (Continent in http://www.smartclient.com/smartgwt/showcase/#grid_editing_row).


    Is there any way to make the ListGrid ignore the UP & DOWN keys for that field?


    TIA

    #2
    So long as you don't cancel() the event, you should see that your keypress handler has no effect on the built-in behavior. If you're not seeing that, can you shown some sample code?

    Comment


      #3
      "no effect" ?
      Wait, I mean that I want my KeyPressHandler on the FormItem to do something on UP & DOWN rather than following the UP & DOWN of the default ListGrid behavior where UP goes to the next row.

      I'm not cancelling any event, but I also don't see any effect of the UP & DOWN on the FormItem.

      Comment


        #4
        OK, please clarify the exact behavior you want. You said "This is good behavior I don't want to remove". By that, do you mean the built-in behavior (navigate up and down, generally considered "good") or something else that you built?

        Comment


          #5
          I want the behavior from the showcase #grid_editing_row example:

          With UP & DOWN keys, we traverse the rows in edit mode.
          When we enter a formitem which has a valueMap, up & down scrolls trough the possibile values of it. Then you tab out, and continue with the next field. Pressing UP & DOWN again goes to the next row.
          This is built-in and works perfectly.


          I created a custom formitem with a KeyPressHandler and listens for up & down.
          But - although the input fields has focus - hitting UP does not trigger that logic. The ListGrid key handler already kicks in before that and the next row is selected.

          Comment


            #6
            Oh, so you *do* want to cancel the normal up and down navigation?

            If so, since navigation takes place on KeyDown, add a KeyDown handler instead and cancel() the event for UP and DOWN keys.

            Comment

            Working...
            X