| Sample: dhtmlxFolders | Sorting items | dhtmlxFolders main page |

Sort by type asc | desc
Sort by name asc | desc
Sort by size asc | desc

### Order remains while changing types

F-icon
F-tiles
F-table

    <div id="folders_container" style="width:400px;height:300px;overflow:hidden;"></div>

    <script>
        //sort items by attribute "name"
        function sortByName(a,b){
            var aName = a.data.dataObj.getAttribute("name");
            var bName = b.data.dataObj.getAttribute("name");
            if(aName>bName)
                return 1;
            else if(aName==bName)
                return 0;
            else
                return -1;
        }
        //sort ascending
        myFolders.sortItems(sortByName,'asc');
        //sort descending
        myFolders.sortItems(sortByName,'desc');</script>