Skip to content

Commit

Permalink
Merge pull request #10503 from jitendrapurohit/CRM-20556
Browse files Browse the repository at this point in the history
CRM-20556: Fix datatable warning on merge screen
  • Loading branch information
colemanw authored Jun 15, 2017
2 parents 6e190b5 + 2653da9 commit 029ef54
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions templates/CRM/Contact/Page/DedupeFind.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -244,20 +244,17 @@
}
});
// get dataTable
var table = CRM.$('table#dupePairs').DataTable();
// apply the search
$('#searchOptions input').on( 'keyup change', function () {
table
$('table#dupePairs').DataTable()
.column($(this).attr('search-column'))
.search(this.value)
.draw();
});
// show / hide columns
$('input.toggle-vis').on('click', function (e) {
var column = table.column( $(this).attr('data-column-main') );
var column = $('table#dupePairs').DataTable().column( $(this).attr('data-column-main') );
column.visible( ! column.visible() );
// nowrap to conflicts column is applied only during initial rendering
Expand All @@ -268,15 +265,15 @@
}
if ($(this).attr('data-column-dupe')) {
column = table.column( $(this).attr('data-column-dupe') );
column = $('table#dupePairs').DataTable().column( $(this).attr('data-column-dupe') );
column.visible( ! column.visible() );
}
});
// keep the conflicts checkbox checked when context is "conflicts"
if(context == 'conflicts') {
$('#conflicts').attr('checked', true);
var column = table.column( $('#conflicts').attr('data-column-main') );
var column = $('table#dupePairs').DataTable().column( $('#conflicts').attr('data-column-main') );
column.visible( ! column.visible() );
}
Expand All @@ -289,12 +286,12 @@
var request = $.post(postUrl, {pnid : $el.data('pnid')});
request.done(function(dt) {
var mapper = {1:3, 2:4, 5:6, 7:8, 9:10}
var idx = table.row($elTr).index();
var idx = $('table#dupePairs').DataTable().row($elTr).index();
$.each(mapper, function(key, val) {
var v1 = table.cell(idx, key).data();
var v2 = table.cell(idx, val).data();
table.cell(idx, key).data(v2);
table.cell(idx, val).data(v1);
var v1 = $('table#dupePairs').DataTable().cell(idx, key).data();
var v2 = $('table#dupePairs').DataTable().cell(idx, val).data();
$('table#dupePairs').DataTable().cell(idx, key).data(v2);
$('table#dupePairs').DataTable().cell(idx, val).data(v1);
});
// keep the checkbox checked if needed
$('input.crm-dedupe-select', $elTr).prop('checked', $elTr.hasClass('crm-row-selected'));
Expand All @@ -312,12 +309,12 @@
CRM.$.post(dataUrl, {pnid: ids}, function (response) {
var mapper = {1:3, 2:4, 5:6, 7:8, 9:10}
$('.crm-row-selected').each(function() {
var idx = table.row(this).index();
var idx = $('table#dupePairs').DataTable().row(this).index();
$.each(mapper, function(key, val) {
var v1 = table.cell(idx, key).data();
var v2 = table.cell(idx, val).data();
table.cell(idx, key).data(v2);
table.cell(idx, val).data(v1);
var v1 = $('table#dupePairs').DataTable().cell(idx, key).data();
var v2 = $('table#dupePairs').DataTable().cell(idx, val).data();
$('table#dupePairs').DataTable().cell(idx, key).data(v2);
$('table#dupePairs').DataTable().cell(idx, val).data(v1);
});
// keep the checkbox checked if needed
$('input.crm-dedupe-select', this).prop('checked', $(this).hasClass('crm-row-selected'));
Expand Down

0 comments on commit 029ef54

Please sign in to comment.