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

Item classification for a drop-down menu in a dialog box

Community Expert ,
Dec 14, 2019 Dec 14, 2019

Copy link to clipboard

Copied

Hi,

When I create a drop-down menu in a dialog box (list of the fields for example), the items are classified in the unicode character order.

Is it possible to sort them in a customized order or indicate the position of the items?

thanks in advance.

@+

TOPICS
Acrobat SDK and JavaScript

Views

165

Likes

Translate

Translate

Report

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
Community Expert ,
Dec 14, 2019 Dec 14, 2019

Copy link to clipboard

Copied

No. If you want them sorted in another way you can do so by adding "1.", "2.", etc. before them.

Likes

Translate

Translate

Report

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
Community Expert ,
Dec 14, 2019 Dec 14, 2019

Copy link to clipboard

Copied

Well actually, there is an undocument function for inserting items into a list. Items are added to the end of the list. 

 

dialog.insertEntryInList({"item_id":{lst}});

 

where "lst" is the normal object used to initialize a list. It can be one item. 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Likes

Translate

Translate

Report

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
Community Expert ,
Dec 14, 2019 Dec 14, 2019

Copy link to clipboard

Copied

“...can do so by adding "1.", "2.", etc. before them”

that's what I did...

 

dialog.insertEntryInList({"item_id":{lst}});

I will try!

 

thanks

Likes

Translate

Translate

Report

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
Community Expert ,
Dec 14, 2019 Dec 14, 2019

Copy link to clipboard

Copied

This function only controls the order when it is used to add entries one at a time. Groups of entries are sorted within thier own group. 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Likes

Translate

Translate

Report

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
Community Expert ,
Dec 23, 2019 Dec 23, 2019

Copy link to clipboard

Copied

Hi Thom,

Sorry for this late answer.

 dialog.insertEntryInList({ "LST1" : { "abc" : -1 } }); works very well.

I also discovered we can add a separator with:

dialog.insertSeparatorEntryInList("LST1");

Are there any other useful tips like that?

Is it possible for example to write an item in color?

Thanks

@+

Likes

Translate

Translate

Report

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
Community Expert ,
Dec 23, 2019 Dec 23, 2019

Copy link to clipboard

Copied

LATEST

There are some fancier list operations, but color isn't one of them. The problem with many of the undocumented functions is that they are incomplete, which is probably why they are undocumented. If you look around for post on the topic you'll find several things that Adobe employees have posted, particularly in the blogs.

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Likes

Translate

Translate

Report

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