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}’ > customCombo.addOption([[’<c:out value=’${application.projectId}’/>’,’<c:out value=’${application.projectName}’/>’]]); </c:forEach>
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();