It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

PocketQuery: How to disable auto load even when "Load macro dynamically" and "Use change params template" options are un-checked

Pranjal Shukla May 25, 2016

I have incorporated "Change Params Template" as part of my Custom Template hence i have only checked "Enable dynamic parameters" in Macro Definition on the page. I don't want PQ to execute query on page load as it is a complex one and takes time. How can i "Disable Auto Load" from the Custom Template i have made?

3 answers

0 votes
Felix Grund May 27, 2016

Thanks for the feedback, Pranjal. DynamicLoad and ChangeParams are currently required unfortunately. It's on the roadmap to enhance this feature. I think you could find a workaround with ChangeParams unchecked (I can help you with that if you want). But DynamicLoad is definitely required currently.

Pranjal Shukla May 29, 2016

That would be great Felix. Currently i have given some special characters in the Default value of parameters for which i know there are no related records in the DB. When the page loads, it loads with the form but with a message as "Query was executed successfully, the result set was empty". This confuses users as they don't know what this message is and what query it is talking about, i need to explain them (As many are from non technical background).

 

BTW, i did try the method of pasting the JQuery code (Custom HTML at the end of the page) mentioned on other ticket but it did not work.

Pranjal Shukla Jun 15, 2016

Felix,

I am waiting for your help on this.

0 votes
Felix Grund Jun 16, 2016

Hi Pranjal,

Thanks for remembering! How about checking DynamicLoad AND ChangeParams and simply hiding the ChangeParams form with CSS in the template?

<style>
.pq-dynamic-parameter-form { display: none; }
</style>

Regards, Felix

Pranjal Shukla Jun 16, 2016

Felix, it did not work, let me tel you why.

I also have a custom form with the same class i.e. class="aui pq-dynamic-parameter-form". So i changed this class name, enabled "Change Params Template", "Dynamic Load" and Disabled "Auto Load". I added the script you gave me in my custom template. The moment i did this, my form got masked by the default form that comes when you enable "Change Params Template".

 

Ideally, the default should be hidden and the one i made should be visible.

Felix Grund Jun 16, 2016

my form got masked by the default form that comes when you enable "Change Params Template"

Sorry, I'm a little lost. You hide the default form .pq-dynamic-parameter-form with CSS. You give your form a different class. I would think the default form would now be hidden and your form would be visible?

Pranjal Shukla Jun 16, 2016

Even if i change the class name of my custom form, my custom form is getting hidden and the default one starts appearing.

 

One more observation, when "Disable AutoLoad" is set to true and no value in the Default Value field, the text fields are not appearing on the page and only Change button is appearing.

 

We can have a quick GoTo meeting session if you are available for 5 mins. I can send you an invite. What do you say?

Pranjal Shukla Jun 22, 2016

Felix,

Please do let me know your suggestions here.

Felix Grund Jun 22, 2016

Hi Pranja, I will reproduce this on my local system during the next days. I'll let you know.

0 votes
Felix Grund Jun 26, 2016

Hi Pranjal,

I created a new beta release for PocketQuery 2.1.1. You can find it here. With this version, the only requirement for "disable autoload" will be "dynamic load". So you should be able to use it properly with your own form. Besides that, the issue that fields in the form won't appear if you didn't enter anything should be fixed as well.

Please let check it out and provide me some feedback as always smile. Thanks for your support!

Regards, Felix (Scandio)

Pranjal Shukla Jun 28, 2016

Felix,

Here are the observations:

  • Preview does not load with "Disable autoload" set to true.
  • Since i have my custom form in template, i have disabled (unchecked) "Use change params template". With this unchecked, my custom form does not appear.
  • When i check (enable) "Use change params template", I see default form of PQ despite my form there in the template.
  • When i search using the default form, the results get loaded along with my custom form.

It seems that template associated with a query is getting loaded/executed only when result is being displayed.

Have a look at the Snapshot below:

image2016-6-28 17:2:14.png

Pranjal Shukla Jun 28, 2016

Felix,

I guess the template always loads at the time of results. Since i have my default values defined as junk (in prod instance), the query returns empty result on page load along with a message and my form along with this. This gives an impression that form is loading on the page load but actually that's not the case.

This scenario changes when you check "disable auto load" and uncheck "Show change params template", you actually don't see anything.

Also, if you are just executing standalone query like "select * from emp;" and "disable auto load", you'll see a blank page which is obvious and users will not even get to know that there is a macro there. Ideally for queries without parameters, there should be some way to execute queries with Auto Load disabled.

OR, "Disable auto load" should be kept for queries only with parameters not with others.

I may not have explained the case in proper order but hope you get the gist.

The only reason i defined my custom form was:

  • To have field names in bold.
  • Hide default values.
  • Change the name of button to Search.

 

Felix Grund Jun 28, 2016

I see what you are saying with "disable autoload". Maybe you can try it with simple CSS and JS and use the default change params template:

<style>
.pq-dynamic-parameter-form label { font-weight: bold; }
</style>
$PocketQuery.template("default")
<script>
jQuery('.pq-change-button').text('My Button');
jQuery('.pq-dynamic-parameter-form input').val('');
</script>

However, there will be a delay until this is really done...

Felix Grund Jun 28, 2016

Another workaround would be to use two queries. One is only for the form and is kind of a dummy query like "SELECT 1". In the template with the form, you can use JS to render another query that actually produces the result. I put up an example for someone else one day that you can find here: 

Maybe this helps.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Confluence

Confluence CVEs and common questions

Two vulnerabilities have been published for Confluence Server and Data Center recently: March 20, 2019 CVE-2019-3395 / CVE-2019-3396 April 17, 2019 CVE-2019-3398 The goal of this article is...

948 views 0 19
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you