##// END OF EJS Templates
admin-users: cleanup JS code.
marcink -
r1648:56bc1e18 default
parent child Browse files
Show More
@@ -38,9 +38,10 b''
38 <script type="text/javascript">
38 <script type="text/javascript">
39
39
40 $(document).ready(function() {
40 $(document).ready(function() {
41 var $userListTable = $('#user_list_table');
41
42
42 var getDatatableCount = function(){
43 var getDatatableCount = function(){
43 var table = $('#user_list_table').dataTable();
44 var table = $userListTable.dataTable();
44 var page = table.api().page.info();
45 var page = table.api().page.info();
45 var active = page.recordsDisplay;
46 var active = page.recordsDisplay;
46 var total = page.recordsTotal;
47 var total = page.recordsTotal;
@@ -50,7 +51,7 b''
50 };
51 };
51
52
52 // user list
53 // user list
53 $('#user_list_table').DataTable({
54 $userListTable.DataTable({
54 processing: true,
55 processing: true,
55 serverSide: true,
56 serverSide: true,
56 ajax: "${h.route_path('users_data')}",
57 ajax: "${h.route_path('users_data')}",
@@ -76,7 +77,7 b''
76 { data: {"_": "extern_type",
77 { data: {"_": "extern_type",
77 "sort": "extern_type"}, title: "${_('Auth type')}", className: "td-type" },
78 "sort": "extern_type"}, title: "${_('Auth type')}", className: "td-type" },
78 { data: {"_": "action",
79 { data: {"_": "action",
79 "sort": "action"}, title: "${_('Action')}", className: "td-action" }
80 "sort": "action"}, title: "${_('Action')}", className: "td-action", orderable: false }
80 ],
81 ],
81 language: {
82 language: {
82 paginate: DEFAULT_GRID_PAGINATION,
83 paginate: DEFAULT_GRID_PAGINATION,
@@ -91,23 +92,23 b''
91 }
92 }
92 });
93 });
93
94
94 $('#user_list_table').on('xhr.dt', function(e, settings, json, xhr){
95 $userListTable.on('xhr.dt', function(e, settings, json, xhr){
95 $('#user_list_table').css('opacity', 1);
96 $userListTable.css('opacity', 1);
96 });
97 });
97
98
98 $('#user_list_table').on('preXhr.dt', function(e, settings, data){
99 $userListTable.on('preXhr.dt', function(e, settings, data){
99 $('#user_list_table').css('opacity', 0.3);
100 $userListTable.css('opacity', 0.3);
100 });
101 });
101
102
102 // refresh counters on draw
103 // refresh counters on draw
103 $('#user_list_table').on('draw.dt', function(){
104 $userListTable.on('draw.dt', function(){
104 getDatatableCount();
105 getDatatableCount();
105 });
106 });
106
107
107 // filter
108 // filter
108 $('#q_filter').on('keyup',
109 $('#q_filter').on('keyup',
109 $.debounce(250, function() {
110 $.debounce(250, function() {
110 $('#user_list_table').DataTable().search(
111 $userListTable.DataTable().search(
111 $('#q_filter').val()
112 $('#q_filter').val()
112 ).draw();
113 ).draw();
113 })
114 })
General Comments 0
You need to be logged in to leave comments. Login now