Skip to Content
author's profile photo
Former Member

Dynamic dropdown(supply function)

Hi,

I have a requirement where I have to populate dropdown_by_key2 values on selecion of value of dropdown_by_key1.

Hence in componentcontroller context i created a node as subnode of another node. Now i am trying to use supply function in my child node to populate dropdown_by_key_2.

Could I have the code for supply function? I am not able to populate this.

Also is my design if parent child node relation correct? and should the code be written in supply function of child?

Regards,

Vishal Bhatia

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • author's profile photo
    Former Member
    Posted on Apr 29, 2011 at 11:51 AM

    First, you have to use DropDownByIndex for this scenario.

    You can implement the supply function like

    Context:
    + ItemsOfFirstList (node, card=0:n, selection=0:1)
       + text (string)
       + ItemsOfSecondList (node, card=0:n, selection=0:1, supplyFunction=supplyItemsOfSecondList, singleton=true)
          + text (string)
    
    void supplyItemsOfSecondList(IItemsOfFirstListElement parentElement, IItemsOfSecondListNode node)
    {
      if (parentElement.getText().equals("some_value"))
      {
        /* add elements to node depending on some_value */
      }
      else ...
    }
    

    Bind the "texts" properties of each drop-down list to the "text" attribute of the corresponding context node.

    Additionally, assign an action to the "onSelect" event of the first drop-down list such that a server roundtrip occurs when a value is selected. This server roundtrip will trigger a call to the supply function of the second list because the lead-selection of the first context node was changed by selecting an entry in the first drop-down list.

    Add comment
    10|10000 characters needed characters exceeded