1 Reply Latest reply on Sep 22, 2010 7:16 AM by Andreas Jansson

    A small note about Item key or itemData for listitems in a dropdown box ( combo box )

    Andreas Jansson Level 2

      Looking for a built-in way to let the user select an item in a list, but to return a corresponding key (that should not be visible to the user), I was pleased to see that the javascript way of automatically expanding objects with new properties came in handy:

       

          myDlg.Panel1.DropDownList1.ListItem3 = myDlg.Panel1.DropDownList1.add('item','The text to show');
          myDlg.Panel1.DropDownList1.ListItem1.listKey = 'my secret code';  // listKey is not a default property
      

       

      The list item is now expanded with a new property called listKey, and the "key" of the selected item can be found in this way:

           myDlg.Panel1.DropDownList1.items[marketDlg.Panel1.DropDownList1.selection.index].listKey

       

       

      I hope you get the idea, and that this might be helpful for someone looking for the same thing.

       

      Andreas