Wijmo UI for the Web
Allow Sorting

The wijgrid widget allows users to sort data by setting the allowSorting option to true. A user can click the header of a column to sort in ascending order and click it again to sort in descending order.

Script
Copy Code
<script id="scriptInit" type="text/javascript">
    require(["wijmo.wijgrid"], function () {
        $(document).ready(function () {
            $("#wijgrid").wijgrid({

                cellClicked: function (e, args) {
                    alert(args.cell.value());
                },
                allowSorting: true,
                data: [
                    ['Ipsum LLC', 63.57, 209, .11, '02-01-2014', 'True'],
                    ['Lorem Inc', 74.85, 73, .19, '02-01-2014', 'False'],
                    ['Dolor International', 29.86, 45, .20, '02-01-2014', 'False'],
                    ['Blandit Enterprises', 81.68, 28, .25, '02-01-2014', 'True'],
                    ['Vivamus Services', 76.30, 67, .12, '02-01-2014', 'True'],
                ],
                columns: [
                    { headerText: "Product Name", dataType: 'string', allowSort: false},
                    { headerText: "Unit Price", dataType: 'currency', sortDirection: "descending" },
                    { headerText: "Quantity", dataType: 'number', dataFormatString: 'n0', allowSort: true, sortDirection: 'ascending' },
                    { headerText: "Discount", dataType: 'number', dataFormatString: 'p0' },
                    { headerText: "Order Date", dataType: 'datetime', dataFormatString: 'dd-MMM-yyyy', allowSort: false},
                    { headerText: "Overseas", dataType: 'boolean' },

                ]
                

                
                
            });
        });
    });
</script>