Skip to content

Commit

Permalink
Merge pull request #44 from eea/develop
Browse files Browse the repository at this point in the history
fix initialisation of datatables
  • Loading branch information
valipod authored Dec 17, 2021
2 parents e1a3334 + 7223168 commit c0aa127
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 50 deletions.
7 changes: 6 additions & 1 deletion docs/HISTORY.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
Changelog
=========

3.7 - (2021-12-17)
---------------------------
* [bugfix] fix initialisation of datatables
[valipod refs #142972]

3.6 - (2021-12-09)
---------------------------
* tables in nfp_nrc set to datatable
* [feature] tables in nfp_nrc set to datatable
[valipod refs #142972]

3.5 - (2021-11-22)
Expand Down
2 changes: 1 addition & 1 deletion eea/ldapadmin/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.6
3.7
40 changes: 24 additions & 16 deletions eea/ldapadmin/zpt/nfp_nrc/awps.zpt
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@
$.each(result['roles'], function(i2, role){

var users = $('<tbody>');
var is_odd = 'odd';
$.each(role['users'], function(i3, user_info){
var is_disabled = (user_info['status'] == 'disabled');
var is_disabled_class = (is_disabled) ? 'disabled_user' : '';
var klass = is_odd + is_disabled_class;
var klass = is_disabled_class;
var user = $('<tr>').addClass(klass)

var name = $('<td>');
Expand Down Expand Up @@ -118,7 +117,6 @@
}

users.append(user);
is_odd = (is_odd == 'odd') ? 'even' : 'odd';
});

$('#' + div_id)
Expand Down Expand Up @@ -164,24 +162,34 @@
.html('<img src="/++resource++eea.ldapadmin-www/up.png" class="middle-image image12" alt="" title="Back to top" /> Back to top')
)
).append($('<div>').addClass('clear').html('&nbsp;'))
if (i1 + 1 == role_dns_count) {
$('#loading').slideUp();
requirejs(["datatables.net"], function() {
window.data_table = $('.dataTable').dataTable({
"aaSorting": [[0, "asc"]],
"sPaginationType": "full_numbers",
"aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
"oLanguage": {
"sSearch": "Apply filter _INPUT_ to table"
}
});
});
}
});
/* we run datatable initialisation for each table,
so we don't wait until the last ajax call finishes */
initialize_datatable();
if (top_role_dns.length - count == 0) {
$('#loading').slideUp();
// initialize_datatable();
}
}
});
});
});

function initialize_datatable(){
requirejs(["datatables.net"], function() {
/* since the initialisation is called separately for each new arriving
table, we need to avoid the ones already initialised (having no-footer) */
window.data_table = $('.dataTable').not('.no-footer')
.dataTable({
"aaSorting": [[0, "asc"]],
"sPaginationType": "full_numbers",
"aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
"oLanguage": {
"sSearch": "Apply filter _INPUT_ to table"
}
} )
});
}
</script>

<h1>Reporters for <span tal:replace="options/country_name" /></h1>
Expand Down
40 changes: 24 additions & 16 deletions eea/ldapadmin/zpt/nfp_nrc/extranet_reporters.zpt
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@
$.each(result['roles'], function(i2, role){

var users = $('<tbody>');
var is_odd = 'odd';
$.each(role['users'], function(i3, user_info){
var is_disabled = (user_info['status'] == 'disabled');
var is_disabled_class = (is_disabled) ? 'disabled_user' : '';
var klass = is_odd + is_disabled_class;
var klass = is_disabled_class;
var user = $('<tr>').addClass(klass)

var name = $('<td>');
Expand Down Expand Up @@ -116,7 +115,6 @@
}

users.append(user);
is_odd = (is_odd == 'odd') ? 'even' : 'odd';
});

$('#' + div_id)
Expand Down Expand Up @@ -151,24 +149,34 @@
})
.html('<img src="/++resource++eea.ldapadmin-www/up.png" class="middle-image image12" alt="" title="Back to top" /> Back to top')))
.append($('<div>').addClass('clear').html('&nbsp;'))
if (i1 + 1 == role_dns_count) {
$('#loading').slideUp();
requirejs(["datatables.net"], function() {
window.data_table = $('.dataTable').dataTable({
"aaSorting": [[0, "asc"]],
"sPaginationType": "full_numbers",
"aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
"oLanguage": {
"sSearch": "Apply filter _INPUT_ to table"
}
});
});
}
});
/* we run datatable initialisation for each table,
so we don't wait until the last ajax call finishes */
initialize_datatable();
if (top_role_dns.length - count == 0) {
$('#loading').slideUp();
// initialize_datatable();
}
}
});
});
});

function initialize_datatable(){
requirejs(["datatables.net"], function() {
/* since the initialisation is called separately for each new arriving
table, we need to avoid the ones already initialised (having no-footer) */
window.data_table = $('.dataTable').not('.no-footer')
.dataTable({
"aaSorting": [[0, "asc"]],
"sPaginationType": "full_numbers",
"aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
"oLanguage": {
"sSearch": "Apply filter _INPUT_ to table"
}
} )
});
}
</script>

<h1> Extranet reporters for <span tal:replace="options/country_name" /></h1>
Expand Down
41 changes: 25 additions & 16 deletions eea/ldapadmin/zpt/nfp_nrc/nrcs.zpt
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@
$.each(result['roles'], function(i2, role){

var users = $('<tbody>');
var is_odd = 'odd';
$.each(role['users'], function(i3, user_info){
var is_disabled = (user_info['status'] == 'disabled');
var is_disabled_class = (is_disabled) ? 'disabled_user' : '';
var klass = is_odd + is_disabled_class;
var klass = is_disabled_class;
var user = $('<tr>').addClass(klass)

var radio = $('<td>');
Expand Down Expand Up @@ -137,7 +136,6 @@
}

users.append(user);
is_odd = (is_odd == 'odd') ? 'even' : 'odd';
});

$('#' + div_id)
Expand Down Expand Up @@ -183,24 +181,35 @@
})
.html('<img src="/++resource++eea.ldapadmin-www/up.png" class="middle-image image12" alt="" title="Back to top" /> Back to top')))
.append($('<div>').addClass('clear').html('&nbsp;'))
if (i1 + 1 == role_dns_count) {
$('#loading').slideUp();
requirejs(["datatables.net"], function() {
window.data_table = $('.dataTable').dataTable({
"aaSorting": [[1, "asc"]],
"sPaginationType": "full_numbers",
"aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
"oLanguage": {
"sSearch": "Apply filter _INPUT_ to table"
}
});
});
}
});
/* we run datatable initialisation for each table,
so we don't wait until the last ajax call finishes */
initialize_datatable();
// if (i1 + 1 == role_dns_count) {
if (top_role_dns.length - count == 0) {
$('#loading').slideUp();
// initialize_datatable();
}
}
});
});
});

function initialize_datatable(){
requirejs(["datatables.net"], function() {
/* since the initialisation is called separately for each new arriving
table, we need to avoid the ones already initialised (having no-footer) */
window.data_table = $('.dataTable').not('.no-footer')
.dataTable({
"aaSorting": [[1, "asc"]],
"sPaginationType": "full_numbers",
"aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
"oLanguage": {
"sSearch": "Apply filter _INPUT_ to table"
}
} )
});
}
</script>

<h1> Eionet Groups for <span tal:replace="options/country_name" /></h1>
Expand Down

0 comments on commit c0aa127

Please sign in to comment.