question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot change the width of Table column

See original GitHub issue

Hi,

I am trying to change the width of column and also the formatter of column. But it seems not to work as expected. Here is my code!

import holoviews as hv
from bokeh.models import HTMLTemplateFormatter

hv.extension('bokeh')

def apply_format(plot, element):
    plot.handles['table'].columns[0].width = 100
    plot.handles['table'].columns[0].formatter=HTMLTemplateFormatter(template='<a href="<%= value %>"><%= value %></a>')

gender = ['M','M', 'M','F']
age = [10,16,13,12]
weight = [15,18,16,10]
height = [0.8,0.6,0.7,0.8]
profile=['http://a.com', 'httmp://b.com', 'http://c.com', 'http://d.com']

table = hv.Table({'Gender':gender, 'Age':age, 'Weight':weight, 'Height':height, 'Profile': profile},
                 ['Profile', 'Gender', 'Age'],  ['Weight', 'Height'])
table.groupby('Gender').opts(height=140, width=700, hooks=[apply_format])

Anyone has the same issue or know how to do this properly?

Thanks, Tran

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
suilujcommented, Apr 9, 2021

I noticed that column width resizing did not work until i changed the default autosize_mode

def apply_format(plot, element):
    # plot.handles['table'].index_position = None # hide index
    # plot.handles['table'].index_width = 100 # change index size
    plot.handles['table'].autosize_mode = "none"
    plot.handles['table'].columns[0].width = 60 
    plot.handles['table'].columns[1].width = 100
    plot.handles['table'].columns[2].width = 50
    plot.handles['table'].columns[3].width = 200
1reaction
suilujcommented, Apr 13, 2021

@xtutran no problem. Do you still use the hv.Table somewhere. In case it helped you could close this issue then.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't adjust table column width - Microsoft Community Hub
Set the column widths as you want them to be -- either by dragging the column borders or the markers on the ribbon ......
Read more >
Can't change table cell width - Stack Overflow
This table should be divided into 1x3 cells, each containing a select combo box. Now the inner table always takes too big width...
Read more >
Column width won't adjust - Google Groups
Column width won't adjust · 1. Click "layout" besides "Table Design" · 2. Click "Cell Margins" · 3. the "Table Options" window will...
Read more >
How to fix the width of columns in the table ? - GeeksforGeeks
The width of the columns i.e. td in a table can be fixed very easily. This can be done by adding the width...
Read more >
Precisely Adjusting Table Column Widths - Word Ribbon Tips
Select the column whose width you want to change. · Display the Layout tab of the ribbon. · Click the Properties option in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found