Drop-down list sorting

My application have a drop down list with many options arranged in alphabetical order by the Option::text property. When you switch to another language, for example, the order must change, but there is no way to sort again drop-down list.

Anyone know the best approach for this problem?

Illustrating what I need:

{Drop-down list

options]

Option {value: "fr", text: qsTr ("English")},

Option {value: "tl", qsTr ("Filipino")}

]

}

Translated into Portuguese, the Option for English becomes "Ingles" and should be placed after "Filipina."

Any clue?

Hello

I wrote the following code, please try if it works for you:

import bb.cascades 1.0

Page
{
  function repopulateDropDown()
  {
    dropDown.removeAll();

    var languages = [
        qsTr("English"),
        qsTr("Filipino")
    ]

    languages.sort()

    for (var i = 0, arrLength = languages.length; i < arrLength; i++) {
      var option = optionDef.createObject();
      option.text = languages[i];
      dropDown.add(option);
    }
  }

  onCreationCompleted:
  {
    repopulateDropDown();
  }

  content: ScrollView {
    DropDown {
      id: dropDown

      attachedObjects: [
        LocaleHandler  {
          id: localeHandler
          onLanguageChanged: {
            repopulateDropDown();
          }
        }
      ]
    }
  }

  attachedObjects: [
    ComponentDefinition {
      id: optionDef
      Option {}
    }
  ]
}

The strange thing I noticed is that languageChange signal is emitted twice for every change of language. Does anyone know why? This should not affect this code well.

Tags: BlackBerry Developers

Similar Questions

  • A drop-down list sorting

    I have a pull down the area populated by a case statement. I want to sort this list by alphanumeric order 'on the fly', if this is possible. Is there some kind of script "comes out" who will do this?

    Thank you

    -pc

    Ok

    in this case, you can use a script in the entry: event from the drop-down list that retrieves all current records, sort them and write them back into the box.

    var ListItems = new Array();


    for (var i = 0; i)< this.length;="">

    {

    nItem var = this.getSaveItem (i);

    ListItems.splice (i, i, nItem);

    ListItems.sort ();

    }

    this.clearItems ();


    for (var i = 0; i)< listitems.length;="">

    {

    this.addItem (ListItems [i]);

    }

    Hope this helps

  • How can I sort alphabetically in the drop-down list in the Tools menu of Firefox?

    The Tools menu has a drop-down list, but the entries are not in alphabetical order. Options and a few individual add-ons/extensions appear in the list, but not in alphabetical order. It would be useful to them in alphabetical order in the list, however, I can't find any option to sort. Did I miss a hidden, built-in option for sorting? Is there an add-on may be providing a way to sort? Someone has an idea? I have not found anything this either in my research on the subject... just what is the sorting of bookmarks. But it's the combo of Tools menu I want to be able to twist. Anyone?

    There is no built-in opportunities to change the menus of the application. The easiest way to do this is by using the editor from Menu Add-on.

    Advanced users familiar with CSS can create a custom style sheet and apply it with Stylish.

  • Sort of a drop-down list in the content

    Hello

    Maybe it's a simple question, but I just started working with UCM and have a question. I have a metadata field that is filled using a drop-down list. Looks like the list is sorted according to the date and time, I added the list of values. I want to sort the list alphabetically in ascending according to the label in the view order. I looked everywhere in the documentation but can't find it in any way.

    Can someone point me to the right solution?

    Thank you.

    Bigmc

    This is for a custom metadata field or out of the box? If ootb, which field?

    Where are you trying to find information? I wonder where you are looking that you can't find it. It is documented in a few places in the document 'Managing Oracle WebCenter content':

    http://docs.Oracle.com/CD/E29542_01/doc.1111/e26693.PDF

    -ryan

  • How can I change the order in the drop-down list the address bar?

    I like Firefox, but one thing I want to change is the behavior of the address bar drop-down list - where it shows the previous sites I visited. I'm looking for a way to list of these in chronological order - so the most recently visited site is at the top. know how it is in IE!

    Is this possible? I'm happy to go in and change settings or install any addons that I need to do.

    Hello zeel, this article explains how the sorting mechanism in the firefox url bar: https://developer.mozilla.org/en-US/docs/The_Places_frecency_algorithm

    Although there are some settings to adjust the table available when you go to Subject: config I don't think it's possible to achieve your goal exactly using the built - in firefox. You can set the preferences (increase) of the value of the . places.frecency * BucketWeight while to increase the rank of the most recent visits and adjust the timespan in days for different buckets through the . places.frecency * BucketCutoff...

  • Affect results column Drop Down, list of values


    Interactive reporting vs Hyperion 9

    I have a drop down filter that I use in a dashboard report. Works very well.  I have no problem creating drop-down filter when the list of values are typed by me by hand. As the year 2013, 2012, 2011, 2010.  Or region, North, South, East or West.  But what happens if I want to filter by customer name?  We have hundreds of customers in the table.  In addition, accounts receivable change daily.  How can I get the drop down to view the customers? In consideration of the separate alphbetically, sorted?  It would be extremely useful to my users to have the ability to produce sales for a particular client activity... in fact, essential.  How to configure the drop-down list?

    have you tried the code with a button first?  Doing a job?

    If you used the code above there are two small errors in there

    for (var i = 1; i)< arr.length;="" i++)="">

    If (arr [i - 1]! = arr [i]) oDrp. Add (arr [i - 1]);

    }

    If (arr [i - 1]! = arr [i]) oDrp. Add (arr [i]);

    should be

    for (var i = 1; i)< arr.length;="" i++)="">

    If (arr [i - 1]! = arr [i]) oDrp. Add (arr [i - 1]);

    }

    If (arr [i - 1]! = arr [i]) oDrp. Add (arr [i]);

    Please copy - paste your code here.

  • ADD ITEMS TO THE LIST DROP-DOWN LIST TO A TEXT FIELD (USER ENTERS THE ITEM) AND ALSO RELATED TO VALUE

    Untitled.jpg

    I have WANTED to ADD of ELEMENTS from the list drop-DOWN OF THE AREA of TEXT (the ELEMENT NAME) WHERE the USER BETWEEN of THE DESCRIPTION of POINT

    AND RELATED value SHOULD ALSO BE ADDED to THE SAME ELEMENT.

    LIKEWISE REMOVE ITEMS IN THE DROP-DOWN LIST

    PLEASE GIVE SHAPE TO SAMPLE OR JAVASCRIPT FOR THE ABOVE SCENARIO...

    INDEED USEFUL FOR MY PROJECT PLEASE SEND PDF FORM

    Hi Praveen,

    You can add items to the list in a specific order, which would be to load the elements in an array, sorting and then load in the dropdown list drop-down list.  This would be in the click event of the button Add.

    Create a table to hold all the list items, table drop-down list contains objects with a property 'displayItem' and 'value '.

    dropDownItems var = [];

    Add the new

    dropDownItems.push ({displayItem: ItemName.rawValue, value: BoundValue.rawValue});

    Add existing ones

    for (var i = 0; i)< dropdownlist1.length;="">

    {

    dropDownItems.push ({displayItem: DropDownList1.getDisplayItem (i), value: DropDownList1.getSaveItem (i)})

    }

    Sort by ascending order of displayed text

    () dropDownItems.sort

    function (a, b)

    {

    If (a.displayItem< b.displayitem)="" return="">

    If (a.displayItem > b.displayItem) return 1;

    return 0;

    });

    clear all items

    DropDownList1.clearItems ();

    load the sorted items

    for (var i = 0; i)< dropdownitems.length;="">

    {

    var dropDownItem = [i] dropDownItems;

    DropDownList1.addItem (dropDownItem.displayItem, dropDownItem.value);

    }

    clear the fields of the source

    ItemName.rawValue = null;

    BoundValue.rawValue = null;

    I added a button 'Add' sorted in my sample https://workspaces.acrobat.com/?d=OwysfJa-Q3HhPtFlgRb62g

    Concerning

    Bruce

  • How to import a list from a drop-down list?

    I have a list of 500 names that I need to import in a drop-down list instead of typing them one by one.

    Can someone point me in the right direction?

    I tried all sorts of things but can't get the first line to stick in the drop-down Options menu.

    Help, please! Tight deadline!


    Thank you

    Harry

    Here's a simple form that you can use: https://acrobat.com/?d=sIJoabh12oYOY19AuTZ9yw

    Paste the list into the field of large text at the bottom, click on the button at the top and then copy the drop-down list on the form and paste it into your form.

    This demo has been discussed in a previous thread: http://forums.adobe.com/thread/1025337?start=0&tstart=0

  • Slide to pause until that value is selected from a drop down list?

    Hi there everyone.

    I try to create a cover page of sorts for a simulation of system where the user is asked to enter his name and choose where they work in for a combo box (using the drop-down list box widget)

    I have the name entry part work and the drop-down list box is displayed, but I'm having some problems with it.

    First of all, as soon as a value is selected in the box is jumps to the next slide. I would have rather navigation controlled by a button that the user can make sure that they have chosen the correct value before continuing. Is there a way to do this?

    Hello

    This is the craziest question, but think I found the reason: Although the widget looks a lot smaller in edit mode, when opening it (preview or published) it falls above the button. When I have it away, seems to work. Can you confirm?

    Lilybiri

  • still problems with drop-down list fill the Script

    Well, I used the information I got this forum to fill a drop in a repeatable subform with javascript (and it even works with FormCalc) problem solved. But now when I test the script in format acrobat (with calculations) the last item on my list does not seem to be working properly. They are scripted like that on the preOpen event.

    DropDownListName.additem ("item 1", "1.00");

    DropDownListName.additem ("item 2", "2.00");

    etc.,

    etc.

    They are all the same, and they all show during the test. But when I click on the last item, it automatically entered the first element on the form and for some reason that I don't know, when I click on the arrow to the bottom of the drop-down list once again, will be my listed items 1-6 and 1-6 new (Double listing the items). If I click it a third time he triple will list the elements... Weird! Maybe I'm just tired, but more probably think I do something wrong (again!) Anyone have any ideas?

    One more thing so I don't have to add another post and I hope you people leave him alone. How do the total field sum of script so we round to the nearest cent (1.856 = 1.86) or which is not easy

    Hello

    The second issue of additional items in the drop-down list is easily sorted by including a line in the preOpen to clear the list first.

    DropDownListName.clearItems ();

    This should go before the addItem script.

    This erases the existing list, before be filled again. You would tend to use addItems, where list items will change according to the previous intervention of the user with the form.

    Regarding the round total, you can do this with script (check "Round" in the help file), but it is not necessary.

    When you have the total selected object, just go to the object/field tab and click models. On the display tab, you can select a model of currency with the currency symbol, the 2 decimal and thousands separator (IF your item is a numeric field).

    Good luck

    Niall

  • Raising the event "output" from a drop-down list in all instances of a table row

    I have a drop-down list in a row of table with multiple instances that performs a calculation on the exit event. This calculation takes information from 2 other drop-down lists listed above not repetitive rows of the same table.

    The behavior desired is: If the user change their choices above, all instances of the drop-down list below to execute the "Exit" event script to access the new values above.

    My script is:

    RowOptionalCoverage.DdlCoverageType.execEvent ("exit");     It works, sort of

    It updates only the first instance of RowOptionalCoverage and any subsequent instances. The user can 'Tab' through instances and trigger output for each instance event, but this isn't a reasonable solution.

    I tried using the method resolveNodes without success. I understand, using the method resolveNodes may be required when you reference multiple instances of an object:

    this.resolveNodes ("RowOptionalCoverage [*]. DdlCoverageType [*] ") .execEvent ("exit");"     does not work

    xfa.resolveNodes ("RowOptionalCoverage [*]. DdlCoverageType [*] ") .execEvent ("exit");"      does not work

    No doubt, I have to be incorrectly using the resolveNodes or rate something? Probably something simple.

    All the tips are greatly appreciated.

    Stephen

    Hello Stephen,

    You need to loop through each instance of the line and force the exit event. Without the form, it should look like:

    var oRows = xfa.resolveNodes ("RowOptionalCoverage [*]");
    oNodes var = oRows.length;
        
    for (var i = 0; i)< onodes;="">
    {
    xfa.resolveNode ("RowOptionalCoverage [" + i + "]"). DdlCoverageType.execEvent ("exit");
    }

    You could also index table to determine the number of row repeat:

    var oNodes = RowOptionalCoverage.instanceManager.count;

    You may change this to make it work.

    Good luck

    Niall

  • How to restore the search bar drop-down list and the search engine icon today as it was in version FF 33?

    Some ealier time, I managed to go back to the drop down list via editing about: config and setting browser.search.showOneOffButtons to false.

    But yesterday firefox asked me to improve my search and I agreed. After that, I see ugly new tile instead of the drop-down list.

    How can I go back to find it is old menu drop-down appearance?

    "browser.search.showOneOffButtons" was a temporary pref which lasted from Firefox 34 upward through 42 of Firefox. The underlying code that have supported this preference is gone like Firefox 43.

    https://addons.Mozilla.org/en-us/Firefox/addon/classicthemerestorer/ has an option for old search (experimental) in Options of CTR > UI (1)

  • I need to rearrange the order of the 'required securities' at the top of the drop-down list bookmark.

    Hi, useful friends Firefox,.

    I need help to reorganize my combo of bookmarks to make things run in the way that I like. I am former fighter user of Firefox (and Mozilla/Composer etc. way back when). I use Firefox 42.0 on openSUSE 13.2. These two are completely up to date. I'm a fan of Firefox, which is the only browser that I use on my laptop.

    My question is about how to prefix some unwanted with "ZZZ -" titles to make sure they appear only at the bottom of the drop-down list of bookmarks, rather than at the top. The problem is that these six tracks only appear on the list box dropdown bookmarks when I press < Alt > + < B >. They do not appear in the window "library / all bookmarks" in a way I can modify them to insert the prefix. The six titles that I want to move to a more appropriate (and less prominent) space in the list are:
    View all bookmarks
    Bookmark this page
    Subscribe to this page
    To bookmark all tabs
    Bookmarks toolbar
    Download bookmark modules

    I won't be taken away entirely optional. That's why I wish they were downstairs. I just want to get them out of sight, since I was a very organized hierarchy within my bookmark system. I always use strikes, never the pointer clicks, allowing access to my favorites. Those with six in my view area when I opened my favorites to get some desired that URL seems unnecessary. By placing a prefix ZZZ - in front of them, they in alphabetical index would be at the bottom of the list, rather than at the top.

    I would like any ideas you have to help me move these six titles.

    Thank you

    Dave

    Those are the elements that appear in the list by default.
    You can try to give them a higher value of - moz-box-ordinal-group to reorder the items and move them down.
    All items have to - moz-box-ordinal-group: 1 by default.
    You can set the number to set a specific order of each of the elements.

    Add code to the file userChrome.css below default @namespace.

    @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */
    
    #bookmarksToolbarFolderMenu,#bookmarksMenuItemsSeparator {-moz-box-ordinal-group:10}
    #bookmarksShowAll, #organizeBookmarksSeparator {-moz-box-ordinal-group:15}
    
    #menu_bookmarkThisPage,
    #subscribeToPageMenuitem,
    #menu_bookmarkAllTabs {-moz-box-ordinal-group:11}
    
    #menu_unsortedBookmarks {}
    

    The file userChrome.css (UI) customization and userContent.css (Web sites) are located in the folder of chrome in the Firefox profile folder.

    See also *.

  • If Google is my default search, can I go and change it if I want to do a search for GMaps; only the default is in the search drop-down list.

    If Google is my default search, can I go and change it if I want to do a search for GMaps; only the default is in the search drop-down list.
    So I have to change the default to Google Maps then back to Google to search for one.

    I have it! It's the topic: config "hiddenoneoffs" where the 3 elements of google, maps and mcafee have been included. There was no space between Google and maps. I put one in from Google Maps. She appeared in the first box-ff, but not sure about the search in the second time zone. I went back to the subject: one-offs. Safe search was shown with a space after Secure. I took out the space. Safe search arose in the 2nd single search box!
    Weird! This is contrary to how they show in the search parameters.
    Can I have messed that when Firefox has been reset all the search engines on an update, but I do not.
    Either incidentally, I tried to re-installation characteristic but the file comes down as a .dmg that I'm not familiar with and don't apparently is 8.0 to win because he couldn't open it. Thank you once again.

  • create the mailing list option missing from 'File', 'New' drop-down list in the 38.3.0 version

    Hi all

    I'm trying to create a mailing list using the steps described in the online documentation, but the "Mailing List" does not appear in the fly-out drop-down list. What I am doing wrong?

    In addition, what is the best way to import a mailing list I have in Eudora?

    TIA

    straysaver

    Thank you for your response. New list appears, under address book.

Maybe you are looking for