rowCallback fix
authordeepak-srivastava <deepak.srivastava.0303@gmail.com>
Wed, 12 Aug 2015 20:17:32 +0000 (21:17 +0100)
committerdeepak-srivastava <deepak.srivastava.0303@gmail.com>
Wed, 12 Aug 2015 20:17:32 +0000 (21:17 +0100)
templates/CRM/Contact/Page/DedupeFind.tpl

index c5cea1436d2d2182f570004ae21dae915947615e..cfb722dd592a739bf0c6b9fc293937ef40a00396 100644 (file)
@@ -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='[]',
         <th data-data="dst_street"   class="crm-contact-duplicate">{ts}Street Address{/ts} 2 ({ts}Duplicate{/ts})</th>
         <th data-data="src_postcode" class="crm-contact">{ts}Postcode{/ts} 1</th>
         <th data-data="dst_postcode" class="crm-contact-duplicate">{ts}Postcode{/ts} 2 ({ts}Duplicate{/ts})</th>
-        <th data-data="conflicts"    class="crm-contact-conflicts">{ts}Conflicts{/ts}</th>
+        <th data-data="conflicts"    class="crm-contact-conflicts crm-pair-conflict">{ts}Conflicts{/ts}</th>
         <th data-data="weight"       class="crm-threshold">{ts}Threshold{/ts}</th>
         <th data-data="actions"      class="crm-empty">&nbsp;</th>
       </tr>
     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;
       });
       
       // 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') );