Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

Enthusiast ,
Sep 22, 2010 Sep 22, 2010

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

TOPICS
Scripting
338
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 22, 2010 Sep 22, 2010
LATEST

This was accidentally marked as question (closing).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines