简体   繁体   中英

Change default order column with checkbox - datatable js

Is there a way of changing the sort column in datatable by checking a checkbox ? When I click a "search button" to get data from database, I want the sort to be whatever the checkboxes as checked, like 1 and 3 or only 2 or only 3 and so on.

example

when i check the box "Nome do Paciente", i want the column "Nome do Paciente" to be the deafult sort for that search.

Documentation OrderBy Filter

The OrderBy Filter can have a collection with the names of columns that you want to order. When you change some check, you can add or remove an element on this array from your controller.

Remmember use this variable in your template. Like this:

<tr ng-repeat="row in rows | orderBy:variableOrderBy">
</tr>

The variable variableOrderBy has the collection of columns.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM