Reload a pocketquery macro with javascript

I use a macro as a filtering basis to be applied o others in a page. All the macros in the page with the only exception of this one are with the option "dynamic load"... I need to refresh this macro by the way of a button calling a function in javascript trying to execute the following code including new parametters (being HD_J_FILTERS the name of my query:

 

function relodafilter(recarga)

{

        var newParameters = {ISDTI: jQuery('#select-isdti').val(),Type: jQuery('#select-type').val(),Status: jQuery('#select-status').val(),Area: jQuery('#select-area').val(),Priorite: jQuery('#select-priorite').val(),Root: jQuery('#select-root').val(),Department: jQuery('#select-department').val(),OrgName: jQuery('#select-orgname').val(),GroupName: jQuery('#select-groupname').val(),Impact: jQuery('#select-impact').val(),Uno: recarga};

        jQuery('#my-pocketquery-form select').change(function() {

    var selectedValue = jQuery(this).val();

    jQuery('.pocketquery-dynamic-load[data-query="HD_J_FILTERS"]').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

        });

    });

});

}

But... anything is "refreshed"... I am missing something? Should maybe change the parametter "dynamicload" somewhere to let it work? I've tried many other options without success!!!

Thanks in advance!

 

1 answer

This widget could not be displayed.

Hi Cuto!

Let's try to break down this a little. Can you please use your browser's developer tools console and run the reload for a secific container? Something like this:

(function() {
	// get the first container for the query HD_J_FILTERS
	var $container = jQuery('.pocketquery-dynamic-load[data-query="HD_J_FILTERS"]').eq(0);
	var dataIndex = $container.data('index');
	var data = PocketQuery.getDynamicLoadData(dataIndex);
	data.queryParameters = ...your new parameter object...
    PocketQuery.load({
        container: $container,
        data: data
    });
}());

If that doesn't work, we can check on where the problem comes from.

Regards, Felix

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

513 views 3 18
Read article

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