X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=templates%2FCRM%2Fcommon%2Fjsortable.tpl;h=58139f21ed15e359b7543ce3eebbc71ea50cff1f;hb=07218de046ef00cb6f5be43179f5db18afa0352d;hp=bcbea30b2bd5bc4a0dd9f6554a733a9faf7ef485;hpb=fcba99eb6892c1006a16fc5451e7074d602b7ade;p=civicrm-core.git diff --git a/templates/CRM/common/jsortable.tpl b/templates/CRM/common/jsortable.tpl index bcbea30b2b..58139f21ed 100644 --- a/templates/CRM/common/jsortable.tpl +++ b/templates/CRM/common/jsortable.tpl @@ -1,8 +1,8 @@ {* +--------------------------------------------------------------------+ - | CiviCRM version 4.5 | + | CiviCRM version 4.6 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2014 | + | Copyright CiviCRM LLC (c) 2004-2015 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -41,27 +41,27 @@ }); return optionId; } - + // for date sorting see http://wiki.civicrm.org/confluence/display/CRMDOC/Sorting+Date+Fields+in+dataTables+Widget - var useAjax = {/literal}{if $useAjax}1{else}0{/if}{literal}; - var sourceUrl = ''; - var useClass = 'display'; + var useAjax = {/literal}{if $useAjax}1{else}0{/if}{literal}, + sourceUrl = '', + useClass = 'display', + tcount = 1, + tableId = []; - var tcount = 1; 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++; + // FIXME: Rewriting DOM ids is probably a bad idea, and could be avoided + $('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,22 +113,7 @@ 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"}There are no records.{/ts}'{literal}; + var noRecordFoundMsg = {/literal}'{ts escape="js"}None found.{/ts}'{literal}; var oTable; if ( useAjax ) {