Skip to content
This repository was archived by the owner on Jun 26, 2023. It is now read-only.

table-panel is rendered as "type": "table-old" with "styles=[]" #240

Open
josteinHellerud opened this issue Jul 1, 2020 · 2 comments
Open

Comments

@josteinHellerud
Copy link

josteinHellerud commented Jul 1, 2020

Hi!

We love Grafonnet and use it a lot - thanks for making it. Recently I stumbled across some weird behaviour with table-panels.

What happened:
When using 'tablePanel.new(...)' and not passing styles as props, leaving it to the default value '[]' makes the table render differently after importing to Grafana. Upon inspection of the panel JSON in Grafana I see that the type is set to "table-old", which means it will not render data links and no lines between the cells (completely white background).

Example:

[...]
  .addPanel(
    tablePanel.new(
			title='test',
			datasource='MySQL test'
		)
		.addTarget(
			sql.target(
                               rawSql="'SELECT * FROM things",
                               format='table'
                )
    ,
     {
      "h": 100,
      "w": 24,
      "x": 0,
      "y": 0
    })

Will after compiling and importing to Grafana produce panel json type: "type": "table-old"

What you expected to happen:
I expected the type to be set to "type": "table". Which means it will render with lines between cells, and data links work.

Potential fix
If I pass styles=null in the tablePanel.new(..) params the type is set to "type": "table" after compiling and importing in Grafana. Perhaps defaulting to styles = null instead of styles = [] could be potential fix?

Anything else we need to know?:

This was done in Grafana 7.0.3.

@josteinHellerud
Copy link
Author

I guess this is related to #236

@tbuchier
Copy link

Faced the same issue, thanks for the workaround styles = null it helped me getting around it !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants