Skip to Content
avatar image
Former Member

Same action from dropdown or button ?

Hello Friends,

I have same action bind to the dropdownkey and button,....

Is it possible to get to know from which UI element the event is invoked ?

like for e.g for dropdown its onSelect property and for button its onAction.....( so in my action which is attatched to onSelect or onAction, can I get to know which one of them has invoked my action )..

Regards,

Edited by: Shah H on Aug 4, 2008 3:50 PM

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Aug 04, 2008 at 02:08 PM

    hi shah,

    Try passing on flag from each action. say some x for onSelect of drop down and some y for onAction of button.

    just read that flag in your actual action and proceed furthur....

    PradeeP

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Shah,

      I am not sure if there is any API available to check the triggered event. But I can give you one way.

      Create a context value attribute (Say eleName ).

      In onActionSelect of dropdown set eleName to 'DROPDOWN'.

      wdContext.currentContextElement().setEleName("DROPDOWN");

      In onAction of button set eleName to 'BUTTON'.

      wdContext.currentContextElement().setEleName("BUTTON");

      So whenever you want know if its invoked via dropdown or via button, just you can check like this.

      if(wdContext.currentContextElement().getEleName().equalsIgnoreCase("BUTTON"))
      {
      //write your logic for button event
      }
      else
      {
      //write your logic for dropdown event
      }

      Regards,

      Siva

  • Aug 04, 2008 at 02:18 PM

    Hi Shah,

    Instead of binding same action for two element.

    use two actions which delegate to the same method.

    you just declare a common method let myMainMethod() .

    Now you declare a context (Value attribute) of type string let the name is myElementName

    now for dropdownkey you declare a action like myDropdownkey

    on this action you write

    {

    wdContext.currentContextelement.setMyElementName("dropdownkey ");

    now call the your function

    myMainMethod() .

    }

    now for button you declare a action like myButton

    on this action you write

    {

    wdContext.currentContextelement.setMyElementName("button");

    now call the your function

    myMainMethod() .

    }

    and in myMainMethod () you check what is the value of myElementName

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 04, 2008 at 02:26 PM

    Yes it is possible but why do you need to know it? As an alternative, use two actions which delegate to the same method.

    Armin

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 06, 2008 at 03:57 AM

    Hi,

    I think parameter mapping would help in your case.

    Regards,

    Murtuza

    Add comment
    10|10000 characters needed characters exceeded