Sorting

18 Aug 20171 minute to read

We can change ListBox items rendering order either as ascending or descending, by using ej.SortOrder property. By default ej.SortOrder will be “None”. Please use code as like in below,

<div class="contents">
          <ul id="selectsection"></ul> 
    </div>
<script type="text/javascript">

 /// <reference path="tsfiles/jquery.d.ts" />
 /// <reference path="tsfiles/ej.web.all.d.ts" />\

module ListBoxComponent {
        $(function () {
            var skills = [{ skill: "F#" }, { skill: "ActionScript" }, { skill: "Delphi" }, { skill: "Basic" },
            { skill: "C++" }, { skill: "ESPOL" }, { skill: "C#" }, { skill: "DBase" }, { skill: "ASP.NET" }
            ];
    var listboxInstance = new ej.ListBox($("#selectsection"), {
                width: "220", dataSource: skills,
                fields: { text: "skill" },
                sortOrder:ej.SortOrder.Descending
                 })
            });
}
 </script>