PocketQuery and SQLforConfluence

Hi.

I have 2 the same sql query with columns: ID, Summary, Desc

In PocketQuery, data is displayed with the same column width. But, In SQLForConfluence - columns of different widths.

So, In desc columns I see all the text. 

Could you help me please, is it real in PocketQuery?

1 answer

1 accepted

Hi Artashes,

you can make it possible for the user to change the column width by setting the parameter colresizable:true for the template in question. Then the column widths can be adjusted by draging the borders, so the full content becomes visible. Is this what you have in mind?

This minimalistic template simply adds the resizing function to the default template:

## @param colresizable:true
$PocketQuery.template("default")

"Load macro dynamically" has to be disabled for this to work, that's a known issue we will take care of.

Does this solve your problem? Let me know if you need further help.

Regards,

Carla

Carla Hi!

thx for your reply. Could you tell me please, where is the default template?

If you add a new Query in the PocketQuery administration, you can set a template that is used for displaying it. Among the choices you will always find a template called "default" that is a simple table.

Have you already had a look at the templating section in the PocketQuery Documentation (the very last tab)? You will find lots of information there, including the source code of the default template (in case you want to further adjust it).

The code snippet I gave you above is also a complete and working template. Simply add it as a new template in the PocketQuery administration with a reasonable name and you can select it for your queries.

The templates are quite powerful. It's really worth having a closer look at that feature smile

You are not understood smile

So, what I do:

 

I added new template with code default from your site

<table class="pocketquery-table confluenceTable">
  <tr>
  #foreach ($column in $columns)
    <th class="col-$velocityCount">$!column</th>
  #end
  </tr>
  #foreach ($row in $result)
    <tr class="#if($velocityCount % 2 !=
0)odd#{else}even#end">
    #foreach ($column in $row)
      <td class="col-$velocityCount">$!column</td>
    #end
    </tr>
  #end
</table>

 

Then, I need to add your code(parametr) above. Where?

Ah, you already have your template smile

Then just add the parameter at the very beginning:

## @param colresizable:true
<table class="pocketquery-table confluenceTable">
  <tr>
  #foreach ($column in $columns)
    <th class="col-$velocityCount">$!column</th>
(...)

oookey, but it doesn't work.

Columns the same.

They are initially the same width, but they should be adjustable if you grab the border between two of them with the mouse and move it. Is that not possible?

Hm, could you doublecheck if the option "Load macro dynamically" is disabled? And if this query really does not use the default template anymore but your new customized one?

No, it's not possible.

Option - "load macro dynamically" is disabled. I can sort by column only.

Carla, I resolved.

So. it does not work, if the macros PQ is macros Expand. If macros on page - grab the border works. But after F5 everything returns to its original position. Can we fix columns such as SQLForConfluence?

Interesting behavior with the expend macro, thanks for pointing it out to us!

I just had a closer look at the SQL for Confluence plugin and their table layout. The following template turned out similar for me, please try it out:

<table class="confluenceTable stickyTableHeaders"><tbody>
<tr>
#foreach ($column in $columns)
    <th class="confluenceTh">$!column</th>
  #end
  </tr>
  #foreach ($row in $result)
    <tr">
    #foreach ($column in $row)
      <td class="confluenceTd">$!column</td>
    #end
    </tr>
  #end
</tbody>
<table>

Yes Yes Yes, this is what i need.

I wonna be coders such as you :) What am I should to know?

Thx you very much.

Glad I was able to help smile 

Have fun exploring the possiblities of PocketQuery!

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

385 views 21 10
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