From: Coleman Watts Date: Wed, 1 Oct 2014 19:15:52 +0000 (-0400) Subject: CRM-15130 - Avoid fatal error in jsortable.tpl X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f25b714264dbca835d2a9cb34dcce9007ee6c19d;p=civicrm-core.git CRM-15130 - Avoid fatal error in jsortable.tpl --- diff --git a/templates/CRM/common/jsortable.tpl b/templates/CRM/common/jsortable.tpl index b2797d1798..ecb5d1b310 100644 --- a/templates/CRM/common/jsortable.tpl +++ b/templates/CRM/common/jsortable.tpl @@ -47,21 +47,21 @@ var sourceUrl = ''; var useClass = 'display'; - var tcount = 1; + var tcount = 1, tableId = []; if ( useAjax ) { {/literal}{if isset($sourceUrl)}sourceUrl = "{$sourceUrl}";{/if}{literal} useClass = 'pagerDisplay'; tcount = 5; } - var tableId = [], count = 1; + CRM.dataTableCount = CRM.dataTableCount || 1; //rename id of table with sequence //and create the object for navigation - $('table.' + useClass).each(function() { - $(this).attr('id','option' + tcount + count); - tableId.push(count); - count++; + $('table.' + useClass).not('.dataTable').each(function() { + $(this).attr('id','option' + tcount + CRM.dataTableCount); + tableId.push(CRM.dataTableCount); + CRM.dataTableCount++; }); $.each(tableId, function(i,n){ @@ -113,21 +113,6 @@ eval('sortColumn =[' + sortColumn + ']'); eval('columns =[' + columns + ']'); - var currTable = $(tabId); - if (currTable) { - // contains the dataTables master records - var s = $(document).dataTableSettings; - if (s != 'undefined') { - var len = s.length; - for (var i=0; i < len; i++) { - // if already exists, remove from the array - if (s[i].sInstance = tabId) { - s.splice(i,1); - } - } - } - } - var noRecordFoundMsg = {/literal}'{ts escape="js"}None found.{/ts}'{literal}; var oTable;