From f826cbfc3d34054e12ca4d9301c044d0b98a3e0e Mon Sep 17 00:00:00 2001 From: deepak-srivastava Date: Wed, 12 Aug 2015 21:17:32 +0100 Subject: [PATCH] rowCallback fix --- templates/CRM/Contact/Page/DedupeFind.tpl | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/templates/CRM/Contact/Page/DedupeFind.tpl b/templates/CRM/Contact/Page/DedupeFind.tpl index c5cea1436d..cfb722dd59 100644 --- a/templates/CRM/Contact/Page/DedupeFind.tpl +++ b/templates/CRM/Contact/Page/DedupeFind.tpl @@ -90,7 +90,6 @@ class="form-layout-compressed crm-ajax-table" cellspacing="0" width="100%" - data-length-menu='[[10, 25, 50, 100, 1000, 2000, -1], [10, 25, 50, 100, 1000, 2000, "All"]]', data-searching='true', data-dom='flrtip', data-order='[]', @@ -108,7 +107,7 @@ {ts}Street Address{/ts} 2 ({ts}Duplicate{/ts}) {ts}Postcode{/ts} 1 {ts}Postcode{/ts} 2 ({ts}Duplicate{/ts}) - {ts}Conflicts{/ts} + {ts}Conflicts{/ts} {ts}Threshold{/ts}   @@ -203,9 +202,23 @@ CRM.$('table#dupePairs').data({ "ajax": { "url": {/literal}'{$sourceUrl}'{literal} + }, + rowCallback: function (row, data) { + // Set the checked state of the checkbox in the table + $('input.crm-dedupe-select', row).prop('checked', data.is_selected == 1); + if (data.is_selected == 1) { + $(row).toggleClass('crm-row-selected'); + } + // for action column at the last, set nowrap + $('td:last', row).attr('nowrap','nowrap'); + // for conflcts column + $('td.crm-pair-conflict', row).attr('nowrap','nowrap'); } }); $(function($) { + var sourceUrl = {/literal}'{$sourceUrl}'{literal}; + var context = {/literal}'{$context}'{literal}; + // redraw datatable if searching within selected records $('#crm-dedupe-display-selection').on('click', function(){ reloadUrl = sourceUrl; @@ -275,7 +288,6 @@ }); // keep the conflicts checkbox checked when context is "conflicts" - var context = {/literal}'{$context}'{literal}; if(context == 'conflicts') { $('#conflicts').attr('checked', true); var column = table.column( $('#conflicts').attr('data-column-main') ); -- 2.25.1