Sort by name in alphabetical order not working in data table

天大地大妈咪最大 提交于 2021-01-27 13:37:35

问题


Here i have fetched the data from controller , all are coming fine (according to the alphabetical order) ,but in data table its not coming what i want to get ,means in alphabetical order while viewing .

Here all the data in descending order by default

aaSorting: [[0, "desc"]],

I need it to be sort according to the name field in alphabetical order

I have attached a snap for more clarification. Here i want all the center name should be in alphabetical order.

Please suggest me.


回答1:


<script>

    $(document).ready(function () {
        $('#example1').DataTable({
           aaSorting: [[0, "asc"]]
        });
    });
</script>

After doing a research ,finally got to know this . i just added this js codes below of this page . And results came ,what i need. It may be helpful to anyone else .

Thank you .



来源:https://stackoverflow.com/questions/39265301/sort-by-name-in-alphabetical-order-not-working-in-data-table

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!