How to identify a pocketquery macro of a page in a template?

I have a function in a template to "reload" all the pocketquery macros existing in a page passing new parametters... the problem is that for some of them I have independent templates with some specific functions manipulating some data that are not working with this approach... Thus I intend to bypass that incorporating those functions in the "main" template of the page using the next code.... BUT... how can I identify a PocketQuery name of one of those macros in order to use some "IF" to manipulate ony the data of the macro that is focused???

Should it be something like IF Pocketquery ('index).name THEN xxxxxx but I do not arrive to find the good code to discriminate the macro that I have to manipulate...

I note hereafter part of the code of the function I use to reload the macros.

Any help will be welcome!

Thanks in advance!

_________

var newParameters = { ISDTI: jQuery('#select-isdti').val(),Type: jQuery('#select-type').val(),Annee: jQuery('#select-annee').val(),Mois: jQuery('#select-month').val(),Uno: 1 };
jQuery('.pocketquery-dynamic-load').each(function() {
    var container = jQuery(this);
    var dataIndex = container.data('index');
    var data = PocketQuery.getDynamicLoadData(dataIndex);
    data.queryParameters = newParameters;
    PocketQuery.load({
        container: container,
        data: data
    });
});

 

 

3 answers

1 accepted

0 votes
Accepted answer

Hi Cuto!

If your macros are for different queries, you can simply target your containers like so:

jQuery('.pocketquery-dynamic-load[data-query="YourQueryName"]')

Then you don't need an each loop but you target every container you want to reload separately.

Regards, Felix

Many thanks again Felix!

Is this also valid when the macro is not "dynamicload"? I try to apply this to one macro in a page that I use as a "basis" for filtering others being the other macros "dynamicload" and I find no way to update it with new parametters to be later used as filters...

Thanks in advance!

Hmm. You want to update a PQ macro without dynamic load? You mean that this would refresh the page with dynamic parameters?

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Friday in Jira Service Desk

Looking for anyone who has switched from Zendesk to Jira Service Desk

Hi Community! The Jira Service Desk marketing team is looking for customers who have successfully switched from Zendesk to Jira Service Desk!   We’d love to hear your thoughts on the pros and ...

70 views 6 2
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you