CRM-17918 -- set the scope for dataTable
authorjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Tue, 2 Feb 2016 13:19:21 +0000 (18:49 +0530)
committerjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Tue, 2 Feb 2016 13:19:21 +0000 (18:49 +0530)
CRM/Profile/Page/MultipleRecordFieldsListing.php
templates/CRM/Profile/Page/MultipleRecordFieldsListing.tpl

index b37349b8e574245eb8e19fecc6413f6615645de1..ae46a19c1537d99d5564ebf28d4cc27a5a06f631 100644 (file)
@@ -389,7 +389,7 @@ class CRM_Profile_Page_MultipleRecordFieldsListing extends CRM_Core_Page_Basic {
                 $actionParams['cid'] = $actionParams['entityID'] = $this->_contactId;
                 $actionParams['recId'] = $recId;
                 $actionParams['type'] = $this->_contactType;
-                $actionParams['cgcount'] = $cgcount;
+                $actionParams['cgcount'] = empty($DTparams['sort']) ? $cgcount : $recId;
                 $actionParams['newCgCount'] = $newCgCount;
 
                 // DELETE action links
index 31c560c43b7b2418ba62d56338b6ae2f7f1d2a4a..2b07f7f7bf78d3af8e17d34080d63fd0736f4cf3 100644 (file)
@@ -35,7 +35,7 @@
     <div id="custom-{$customGroupId}-table-wrapper" {if $pageViewType eq 'customDataView'}class="crm-entity" data-entity="contact" data-id="{$contactId}"{/if}>
       <div>
         {strip}
-          <table id="records" class={if $pageViewType eq 'customDataView'}"crm-multifield-selector crm-ajax-table"{else}'display'{/if}>
+          <table id="records-{$customGroupId}" class={if $pageViewType eq 'customDataView'}"crm-multifield-selector crm-ajax-table"{else}'display'{/if}>
             <thead>
             <tr>
             {if $pageViewType eq 'customDataView'}
@@ -52,6 +52,7 @@
               <script type="text/javascript">
                 (function($) {
                   var ZeroRecordText = {/literal}'{ts 1=$customGroupTitle}No records of type \'%1\' found.{/ts}'{literal};
+                  var $table = $('#records-' + {/literal}'{$customGroupId}'{literal});
                   $('table.crm-multifield-selector').data({
                     "ajax": {
                       "url": {/literal}'{crmURL p="civicrm/ajax/multirecordfieldlist" h=0 q="snippet=4&cid=$contactId&cgid=$customGroupId"}'{literal},
@@ -61,7 +62,7 @@
                     },
                     //Add class attributes to cells
                     "rowCallback": function(row, data) {
-                      $('thead th').each( function(index) {
+                      $('thead th', $table).each(function(index) {
                         var fName = $(this).attr('data-data');
                         var cell = $('td:eq(' + index + ')', row);
                         if (typeof data[fName] == 'object') {