Solved

how to do sorting on dhtmlx combo

Posted on 2014-12-11
1
142 Views
Last Modified: 2014-12-17
how to do sorting on dhtmlx combo
0
Comment
1 Comment
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 40496017
instead :
myCombo = new dhtmlXCombo({
    parent:"combo_container",
    items:[
        {value:"2", label:"Two"},
        {value:"1", label:"One"},
        {value:"3", label:"Three"}
    ],
    onChange:function(){
        alert("I'm changed");   
    }
});

Open in new window

use :
var items = [
        {value:"2", label:"Two"},
        {value:"1", label:"One"},
        {value:"3", label:"Three"}
    ];
// here we sort :
items.sort(function(a,b) { return a.value*1>b.value*1 });
myCombo = new dhtmlXCombo({
    parent:"combo_container",
    items:items,
    onChange:function(){
        alert("I'm changed");   
    }
});

Open in new window

0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question