Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by prabhu on May 19, 2008 04:56
open dhtmlx forum
sort the values in the combo box

Hello, I'm trying to sort the values in the combo box.

I'm using dhtmlXCombo.Are there any built in functions available for the sorting.Please help me out...!!!

If there are no built in functions.could you pls help me to write the logic.Thanks! Below is code snippet of my

dhtmlxcombo customCombo = new dhtmlXCombo('applicationId','alfa2',150); customCombo.addOption([['-1','-- Select --']]); customCombo.selectOption( 0 ); customCombo.readonly(true); <c:forEach var='application' items='${LoginPresentationVO.applicationList}' &gt; customCombo.addOption([['<c:out value='${application.projectId}'/&gt;','<c:out value='${application.projectName}'/&gt;']]); </c:forEach&gt;

Answer posted by Support on May 19, 2008 07:49

There is no native way to sort options

Basically it can be done by

combo.optionsArr.sort(function(a,b){

             return a.value>b.value?1:-1;

})

combo.redrawOptions();