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

Cuto Calleja
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 30, 2016

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
Answer accepted
Felix Grund (Scandio)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 31, 2016

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

0 votes
Cuto Calleja
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 30, 2016

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!

Felix Grund (Scandio)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 30, 2016

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

0 votes
Cuto Calleja
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 31, 2016

Many thanks again Felix!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events