Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

PocketQuery and SQLforConfluence

artafon July 26, 2016

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

1 vote
Answer accepted
Carla Roocks (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.
July 26, 2016

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

artafon July 26, 2016

Carla Hi!

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

Carla Roocks (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.
July 26, 2016

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

artafon July 26, 2016

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?

Carla Roocks (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.
July 26, 2016

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>
(...)
artafon July 26, 2016

oookey, but it doesn't work.

Columns the same.

Carla Roocks (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.
July 26, 2016

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?

artafon July 26, 2016

No, it's not possible.

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

artafon July 26, 2016

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?

Carla Roocks (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.
July 28, 2016

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>
artafon July 28, 2016

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.

Carla Roocks (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.
July 28, 2016

Glad I was able to help smile 

Have fun exploring the possiblities of PocketQuery!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events