From 24e7a504d0c06a524b69c14f4b797c422daf9a73 Mon Sep 17 00:00:00 2001 From: Divya Jose Date: Wed, 7 May 2014 19:25:47 +0530 Subject: [PATCH] --CRM-14636 Datatables implimentation causes dom collisions --- templates/CRM/Activity/Selector/Selector.tpl | 6 ++-- templates/CRM/Batch/Form/Search.tpl | 4 +-- templates/CRM/Campaign/Form/Gotv.tpl | 4 +-- .../CRM/Campaign/Form/Search/Campaign.tpl | 4 +-- .../CRM/Campaign/Form/Search/Petition.tpl | 4 +-- templates/CRM/Campaign/Form/Search/Survey.tpl | 4 +-- .../CRM/Campaign/Form/Task/Interview.tpl | 6 ++-- templates/CRM/Contact/Form/Task.tpl | 6 ++-- .../Page/View/RelationshipSelector.tpl | 4 +-- .../CRM/Financial/Form/BatchTransaction.tpl | 34 +++++++++---------- templates/CRM/Financial/Form/Search.tpl | 8 ++--- .../CRM/Financial/Page/BatchTransaction.tpl | 2 +- templates/CRM/Group/Form/Search.tpl | 10 +++--- templates/CRM/Mailing/Page/Tab.tpl | 4 +-- 14 files changed, 50 insertions(+), 50 deletions(-) diff --git a/templates/CRM/Activity/Selector/Selector.tpl b/templates/CRM/Activity/Selector/Selector.tpl index 3b51bffceb..54870dc144 100644 --- a/templates/CRM/Activity/Selector/Selector.tpl +++ b/templates/CRM/Activity/Selector/Selector.tpl @@ -40,7 +40,7 @@ - +
@@ -95,7 +95,7 @@ function buildContactActivities{/literal}{$context}{literal}( filterSearch ) { ZeroRecordText += '.'; } - {/literal}{$context}{literal}oTable = cj('#contact-activity-selector-' + context ).dataTable({ + {/literal}{$context}{literal}oTable = cj('.contact-activity-selector-' + context ).dataTable({ "bFilter" : false, "bAutoWidth" : false, "aaSorting" : [], @@ -158,7 +158,7 @@ function buildContactActivities{/literal}{$context}{literal}( filterSearch ) { } function setSelectorClass{/literal}{$context}{literal}( context ) { - cj('#contact-activity-selector-' + context + ' td:last-child').each( function( ) { + cj('.contact-activity-selector-' + context + ' td:last-child').each( function( ) { cj(this).parent().addClass(cj(this).text() ); }); } diff --git a/templates/CRM/Batch/Form/Search.tpl b/templates/CRM/Batch/Form/Search.tpl index 3d1e08b11d..dd93a85594 100644 --- a/templates/CRM/Batch/Form/Search.tpl +++ b/templates/CRM/Batch/Form/Search.tpl @@ -40,7 +40,7 @@
{ts}New Data Entry Batch{/ts}

-
{ts}Type{/ts}
+
@@ -79,7 +79,7 @@ function buildBatchSelector( filterSearch ) { var columns = ''; var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/batchlist" h=0 q="snippet=4"}'{literal}; - crmBatchSelector = cj('#crm-batch-selector').dataTable({ + crmBatchSelector = cj('.crm-batch-selector').dataTable({ "bFilter" : false, "bAutoWidth" : false, "aaSorting" : [], diff --git a/templates/CRM/Campaign/Form/Gotv.tpl b/templates/CRM/Campaign/Form/Gotv.tpl index 173f58a57e..5e81d4719b 100755 --- a/templates/CRM/Campaign/Form/Gotv.tpl +++ b/templates/CRM/Campaign/Form/Gotv.tpl @@ -47,7 +47,7 @@ {/literal} -
{ts}Batch Name{/ts}
+
@@ -121,7 +121,7 @@ function loadVoterList( ) var searchVoterFor = {/literal}'{$searchVoterFor}'{literal}; - cj( '#gotvVoterRecords' ).dataTable({ + cj( '.gotvVoterRecords' ).dataTable({ "bFilter" : false, "bAutoWidth" : false, "bProcessing": true, diff --git a/templates/CRM/Campaign/Form/Search/Campaign.tpl b/templates/CRM/Campaign/Form/Search/Campaign.tpl index 57486047f1..865ffee2c5 100755 --- a/templates/CRM/Campaign/Form/Search/Campaign.tpl +++ b/templates/CRM/Campaign/Form/Search/Campaign.tpl @@ -48,7 +48,7 @@ }); {/literal} -
+
@@ -196,7 +196,7 @@ } noRecordFoundMsg += searchQill.join(' ...AND...
'); - cj('#campaigns').dataTable({ + cj('.campaigns').dataTable({ "bFilter": false, "bAutoWidth": false, "bProcessing": false, diff --git a/templates/CRM/Campaign/Form/Search/Petition.tpl b/templates/CRM/Campaign/Form/Search/Petition.tpl index 479a18263e..5c85ecb995 100755 --- a/templates/CRM/Campaign/Form/Search/Petition.tpl +++ b/templates/CRM/Campaign/Form/Search/Petition.tpl @@ -52,7 +52,7 @@ {/literal} -
{ts}Campaign ID{/ts}
+
@@ -173,7 +173,7 @@ function loadPetitionList( ) } noRecordFoundMsg += searchQill.join( ' ...AND...
' ); - cj( '#petitions' ).dataTable({ + cj( '.petitions' ).dataTable({ "bFilter" : false, "bAutoWidth" : false, "bProcessing": false, diff --git a/templates/CRM/Campaign/Form/Search/Survey.tpl b/templates/CRM/Campaign/Form/Search/Survey.tpl index 68fa79aa9b..a50f5c2d2d 100755 --- a/templates/CRM/Campaign/Form/Search/Survey.tpl +++ b/templates/CRM/Campaign/Form/Search/Survey.tpl @@ -51,7 +51,7 @@ {/literal} -
{ts}Petition ID{/ts}
+
@@ -183,7 +183,7 @@ function loadSurveyList( ) } noRecordFoundMsg += searchQill.join( ' ...AND...
' ); - cj( '#surveys' ).dataTable({ + cj( '.surveys' ).dataTable({ "bFilter" : false, "bAutoWidth" : false, "bProcessing": false, diff --git a/templates/CRM/Campaign/Form/Task/Interview.tpl b/templates/CRM/Campaign/Form/Task/Interview.tpl index 242d5787bd..c1dee1e932 100644 --- a/templates/CRM/Campaign/Form/Task/Interview.tpl +++ b/templates/CRM/Campaign/Form/Task/Interview.tpl @@ -118,7 +118,7 @@
-
{ts}Survey ID{/ts}
+
{foreach from=$readOnlyFields item=fTitle key=fName} @@ -212,7 +212,7 @@ var updateVoteforall = "{/literal}{ts escape='js'}Update Responses for All{/ts}{ CRM.$(function($) { var count = 0; var columns=''; - cj('#voterRecords th').each( function( ) { + cj('#voterRecords-{/literal}{$instanceId}{literal} th').each( function( ) { if ( cj(this).attr('class') == 'contact_details' ) { columns += '{"sClass": "contact_details"},'; } @@ -226,7 +226,7 @@ CRM.$(function($) { eval('columns =[' + columns + ']'); //load jQuery data table. - cj('#voterRecords').dataTable( { + cj('#voterRecords-{/literal}{$instanceId}{literal}').dataTable( { "sPaginationType": "full_numbers", "bJQueryUI" : true, "aoColumns" : columns diff --git a/templates/CRM/Contact/Form/Task.tpl b/templates/CRM/Contact/Form/Task.tpl index 6a105d20fa..3d00eeb0d7 100644 --- a/templates/CRM/Contact/Form/Task.tpl +++ b/templates/CRM/Contact/Form/Task.tpl @@ -27,7 +27,7 @@ {if $searchtype eq 'ts_sel'}
-
+
@@ -71,7 +71,7 @@ }); var count = 0; var columns = ''; var sortColumn = ''; - $('#selectedRecords th').each(function() { + $('#selectedRecords-{/literal}{$group.id}{literal} th').each(function() { if ($(this).attr('class') == 'contact_details') { sortColumn += '[' + count + ', "asc" ],'; columns += '{"sClass": "contact_details"},'; @@ -88,7 +88,7 @@ eval('columns =[' + columns + ']'); //load jQuery data table. - $('#selectedRecords').dataTable( { + $('#selectedRecords-{/literal}{$group.id}{literal}').dataTable( { "sPaginationType": "full_numbers", "bJQueryUI" : true, "aaSorting" : sortColumn, diff --git a/templates/CRM/Contact/Page/View/RelationshipSelector.tpl b/templates/CRM/Contact/Page/View/RelationshipSelector.tpl index 40b31ff166..fae62fcb90 100644 --- a/templates/CRM/Contact/Page/View/RelationshipSelector.tpl +++ b/templates/CRM/Contact/Page/View/RelationshipSelector.tpl @@ -26,7 +26,7 @@ {* relationship selector *}
-
{ts}Name{/ts}
+
@@ -65,7 +65,7 @@ var ZeroRecordText = {/literal}'{ts escape="js"}There are no relationships entered for this contact.{/ts}'{literal}; } - {/literal}{$context}{literal}oTable = cj('#crm-contact-relationship-selector-' + context).dataTable({ + {/literal}{$context}{literal}oTable = cj('.crm-contact-relationship-selector-' + context).dataTable({ "bFilter": false, "bAutoWidth": false, "aaSorting": [], diff --git a/templates/CRM/Financial/Form/BatchTransaction.tpl b/templates/CRM/Financial/Form/BatchTransaction.tpl index 0ce0b1dfd2..c5f457484e 100644 --- a/templates/CRM/Financial/Form/BatchTransaction.tpl +++ b/templates/CRM/Financial/Form/BatchTransaction.tpl @@ -66,7 +66,7 @@

{strip} -
{ts}Relationship{/ts}
+
@@ -111,17 +111,17 @@ CRM.$(function($) { cj("#trans_assign").prop('disabled',true); cj("#trans_remove").prop('disabled',true); - cj('#crm-transaction-selector-assign #toggleSelect').click( function() { + cj('#crm-transaction-selector-assign-{/literal}{$entityID}{literal} #toggleSelect').click( function() { enableActions('x'); }); - cj('#crm-transaction-selector-remove #toggleSelects').click( function() { + cj('#crm-transaction-selector-remove-{/literal}{$entityID}{literal} #toggleSelects').click( function() { enableActions('y'); }); cj('#Go').click( function() { - return selectAction("trans_assign","toggleSelect", "crm-transaction-selector-assign input[id^='mark_x_']"); + return selectAction("trans_assign","toggleSelect", "crm-transaction-selector-assign-{/literal}{$entityID}{literal} input[id^='mark_x_']"); }); cj('#GoRemove').click( function() { - return selectAction("trans_remove","toggleSelects", "crm-transaction-selector-remove input[id^='mark_y_']"); + return selectAction("trans_remove","toggleSelects", "crm-transaction-selector-remove-{/literal}{$entityID}{literal} input[id^='mark_y_']"); }); cj('#Go').click( function() { if (cj("#trans_assign" ).val() != "" && cj("input[id^='mark_x_']").is(':checked')) { @@ -135,27 +135,27 @@ CRM.$(function($) { } return false; }); - cj("#crm-transaction-selector-assign input[id^='mark_x_']").click( function() { + cj("#crm-transaction-selector-assign-{/literal}{$entityID}{literal} input[id^='mark_x_']").click( function() { enableActions('x'); }); - cj("#crm-transaction-selector-remove input[id^='mark_y_']").click( function() { + cj("#crm-transaction-selector-remove-{/literal}{$entityID}{literal} input[id^='mark_y_']").click( function() { enableActions('y'); }); - cj("#crm-transaction-selector-assign #toggleSelect").click( function() { - if (cj("#crm-transaction-selector-assign #toggleSelect").is(':checked')) { - cj("#crm-transaction-selector-assign input[id^='mark_x_']").prop('checked',true); + cj("#crm-transaction-selector-assign-{/literal}{$entityID}{literal} #toggleSelect").click( function() { + if (cj("#crm-transaction-selector-assign-{/literal}{$entityID}{literal} #toggleSelect").is(':checked')) { + cj("#crm-transaction-selector-assign-{/literal}{$entityID}{literal} input[id^='mark_x_']").prop('checked',true); } else { - cj("#crm-transaction-selector-assign input[id^='mark_x_']").prop('checked',false); + cj("#crm-transaction-selector-assign-{/literal}{$entityID}{literal} input[id^='mark_x_']").prop('checked',false); } }); - cj("#crm-transaction-selector-remove #toggleSelects").click( function() { - if (cj("#crm-transaction-selector-remove #toggleSelects").is(':checked')) { - cj("#crm-transaction-selector-remove input[id^='mark_y_']").prop('checked',true); + cj("#crm-transaction-selector-remove-{/literal}{$entityID}{literal} #toggleSelects").click( function() { + if (cj("#crm-transaction-selector-remove-{/literal}{$entityID}{literal} #toggleSelects").is(':checked')) { + cj("#crm-transaction-selector-remove-{/literal}{$entityID}{literal} input[id^='mark_y_']").prop('checked',true); } else { - cj("#crm-transaction-selector-remove input[id^='mark_y_']").prop('checked',false); + cj("#crm-transaction-selector-remove-{/literal}{$entityID}{literal} input[id^='mark_y_']").prop('checked',false); } }); } @@ -181,7 +181,7 @@ function buildTransactionSelectorAssign(filterSearch) { var ZeroRecordText = '
{/literal}{ts escape="js"}No Contributions found for your search criteria.{/ts}{literal}
'; } - crmBatchSelector1 = cj('#crm-transaction-selector-assign').dataTable({ + crmBatchSelector1 = cj('#crm-transaction-selector-assign-{/literal}{$entityID}{literal}').dataTable({ "bDestroy" : true, "bFilter" : false, "bAutoWidth" : false, @@ -251,7 +251,7 @@ function buildTransactionSelectorRemove( ) { var columns = ''; var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/rest" h=0 q="className=CRM_Financial_Page_AJAX&fnName=getFinancialTransactionsList&snippet=4&context=financialBatch&entityID=$entityID&statusID=$statusID"}'{literal}; - crmBatchSelector = cj('#crm-transaction-selector-remove').dataTable({ + crmBatchSelector = cj('#crm-transaction-selector-remove-{/literal}{$entityID}{literal}').dataTable({ "bDestroy" : true, "bFilter" : false, "bAutoWidth" : false, diff --git a/templates/CRM/Financial/Form/Search.tpl b/templates/CRM/Financial/Form/Search.tpl index 5b6ff9a0d7..4318694293 100644 --- a/templates/CRM/Financial/Form/Search.tpl +++ b/templates/CRM/Financial/Form/Search.tpl @@ -50,7 +50,7 @@
{$form.batch_update.html} {$form.submit.html}

-
{if $statusID eq 1}{$form.toggleSelect.html}{/if}
+
@@ -91,7 +91,7 @@ CRM.$(function($) { var ZeroRecordText = {/literal}'
{ts escape="js"}No Accounting Batches match your search criteria.{/ts}
'{literal}; var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/batchlist" h=0 q="snippet=4&context=financialBatch"}'{literal}; - batchSelector = $('#crm-batch-selector').dataTable({ + batchSelector = $('#crm-batch-selector-{/literal}{$batchStatus}{literal}').dataTable({ "bFilter" : false, "bAutoWidth" : false, "aaSorting" : [], @@ -137,7 +137,7 @@ CRM.$(function($) { } }); checkedRows = []; - $("#crm-batch-selector input.select-row:checked").each(function() { + $("#crm-batch-selector-{/literal}{$batchStatus}{literal} input.select-row:checked").each(function() { checkedRows.push('#' + $(this).attr('id')); }); }, @@ -149,7 +149,7 @@ CRM.$(function($) { return nRow; }, "fnDrawCallback": function(oSettings) { - $('.crm-editable', '#crm-batch-selector').crmEditable(); + $('.crm-editable', '#crm-batch-selector-{/literal}{$batchStatus}{literal}').crmEditable(); $("#toggleSelect").prop('checked', false); if (checkedRows.length) { $(checkedRows.join(',')).prop('checked', true).change(); diff --git a/templates/CRM/Financial/Page/BatchTransaction.tpl b/templates/CRM/Financial/Page/BatchTransaction.tpl index 92d1db1f97..a14c37f859 100644 --- a/templates/CRM/Financial/Page/BatchTransaction.tpl +++ b/templates/CRM/Financial/Page/BatchTransaction.tpl @@ -52,7 +52,7 @@

{strip} -
{$form.toggleSelect.html}
+
diff --git a/templates/CRM/Group/Form/Search.tpl b/templates/CRM/Group/Form/Search.tpl index 1fe66e4672..c39b0d0152 100644 --- a/templates/CRM/Group/Form/Search.tpl +++ b/templates/CRM/Group/Form/Search.tpl @@ -67,7 +67,7 @@
{if $statusID eq 1}{$form.toggleSelects.html}{/if}

- +
@@ -105,7 +105,7 @@ CRM.$(function($) { .on('click', 'a.button, a.action-item[href*="action=update"], a.action-item[href*="action=delete"]', CRM.popup) .on('crmPopupFormSuccess', 'a.button, a.action-item[href*="action=update"], a.action-item[href*="action=delete"]', function() { // Refresh datatable when form completes - $('#crm-group-selector').dataTable().fnDraw(); + $('.crm-group-selector').dataTable().fnDraw(); }); }); @@ -130,7 +130,7 @@ function buildGroupSelector( filterSearch, parentsOnlyArg ) { var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/grouplist" h=0 q="snippet=4"}'{literal}; var showOrgInfo = {/literal}"{$showOrgInfo}"{literal}; - crmGroupSelector = cj('#crm-group-selector').dataTable({ + crmGroupSelector = cj('.crm-group-selector').dataTable({ "bFilter" : false, "bAutoWidth" : false, "aaSorting" : [], @@ -230,7 +230,7 @@ function buildGroupSelector( filterSearch, parentsOnlyArg ) { } function setSelectorClass( parentsOnly, showOrgInfo ) { - cj('#crm-group-selector tr').each( function( ) { + cj('.crm-group-selector tr').each( function( ) { var className = cj(this).find('td:last-child').text(); cj(this).addClass( className ); var rowID = cj(this).find('td:nth-child(2)').text(); @@ -244,7 +244,7 @@ function setSelectorClass( parentsOnly, showOrgInfo ) { } // show hide children -cj('#crm-group-selector').on( 'click', 'span.show-children', function(){ +cj('.crm-group-selector').on( 'click', 'span.show-children', function(){ var showOrgInfo = {/literal}"{$showOrgInfo}"{literal}; var rowID = cj(this).parents('tr').prop('id'); var parentRow = rowID.split('_'); diff --git a/templates/CRM/Mailing/Page/Tab.tpl b/templates/CRM/Mailing/Page/Tab.tpl index 667e889d7b..14a7a7a34c 100644 --- a/templates/CRM/Mailing/Page/Tab.tpl +++ b/templates/CRM/Mailing/Page/Tab.tpl @@ -25,7 +25,7 @@ *}
-
{ts}Name{/ts}
+
@@ -50,7 +50,7 @@ var ZeroRecordText = {/literal}'{ts escape="js"}No mailings found{/ts}.'{literal}; - oTable = $('#contact-mailing-selector').dataTable({ + oTable = $('.contact-mailing-selector').dataTable({ "bFilter": false, "bAutoWidth": false, "aaSorting": [], -- 2.25.1
{ts}Subject{/ts}