DHTMLX Docs & Samples Explorer

Sorting items

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

Order remains while changing types

F-icon
F-titles
F-table
Source
<script src="../../codebase/dhtmlxdataview.js" type="text/javascript"></script>
<script src="../../codebase/types/ftypes.js" type="text/javascript"></script>
<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxdataview.css">  
<link rel="STYLESHEET" type="text/css" href="../../codebase/types/ftypes.css">  
<script>
dhtmlx.image_path = "../../codebase/imgs/";
var data;
function doOnLoad() {
    data = new dhtmlXDataView("data_container");
    changeType("ficon");
    data.load("../common/files_ext.xml");
}
function changeType(type) {
    data.types[type].icons_src_dir = "../common/images";
    data.define("type", type);
}
</script> <div style="position:relative;"> <img src="../common/images/samples_frame.gif" width="436" height="513" alt="" border="0"> <div id="data_container" style="width:396px;height:396px;overflow:hidden;position:absolute;top:65px;left:20px;border:0px solid red;"></div> </div> Sort by type <span style="cursor:pointer;color:blue;text-decoration:underline;" onclick="data.sort('#type#','asc');">asc</span> | <span style="cursor:pointer;color:blue;text-decoration:underline;" onclick="data.sort('#type#','desc');">desc</span><br> Sort by name <span style="cursor:pointer;color:blue;text-decoration:underline;" onclick="data.sort('#name#','asc');">asc</span> | <span style="cursor:pointer;color:blue;text-decoration:underline;" onclick="data.sort('#name#','desc');">desc</span><br> Sort by size <span style="cursor:pointer;color:blue;text-decoration:underline;" onclick="data.sort('#filesize#','asc');">asc</span> | <span style="cursor:pointer;color:blue;text-decoration:underline;" onclick="data.sort('#filesize#','desc');">desc</span><br> <h3>Order remains while changing types</h3> <input type="radio" name="switch" onclick="changeType(this.value)" value="ficon" checked> F-icon<br> <input type="radio" name="switch" onclick="changeType(this.value)" value="ftiles"> F-titles<br> <input type="radio" name="switch" onclick="changeType(this.value)" value="ftable"> F-table<br>