fabien / jquery-option-tree

Automatically exported from code.google.com/p/jquery-option-tree
0 stars 0 forks source link

sort by value (indexed) #8

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Script:

$(document).ready(function() {
                        var options = {choose: 'Katalog...', select_class: 'vertical', indexed: true, set_value_on: 'each', on_each_change: 'http://domain.tld/json_pbekatalog.php', loading_image: '/images/ajax_load.gif'};
                        $.getJSON('http://domain.tld/json_katalog.php', function(tree) { // initialize the tree by loading the file first
                            $('input[name=lnr]').optionTree(tree, options); // .change(displayParents)
                        }); 
                    });

json_katalog.php result:
{"52":"Allgemeines","5":"Bernstein"}

The json data is sorted alphabeticaly by the value. 
- Allgemeins
- Bernstein

The optiontree will sorted by the key 
- Bernstein
- Allgemeines´

How can i display the results in the optiontree as it will be in the json data 
without resorting! Or sort by value?

Version 1.3

Original issue reported on code.google.com by goo...@gobnet.eu on 18 Jan 2012 at 2:57