Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Tabulator buttons #3111

Merged
merged 3 commits into from
Jan 18, 2022
Merged

Implement Tabulator buttons #3111

merged 3 commits into from
Jan 18, 2022

Conversation

philippjfr
Copy link
Member

If you want to trigger custom actions by clicking on a table cell you may declare a set of buttons that are rendered in columns after all the data columns. To respond to button clicks you can register a callback using the on_button_click method:

button_click

@codecov
Copy link

codecov bot commented Jan 18, 2022

Codecov Report

Merging #3111 (a01e6b3) into master (ee9df3b) will decrease coverage by 0.03%.
The diff coverage is 56.52%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3111      +/-   ##
==========================================
- Coverage   83.13%   83.09%   -0.04%     
==========================================
  Files         192      192              
  Lines       25440    25460      +20     
==========================================
+ Hits        21149    21156       +7     
- Misses       4291     4304      +13     
Impacted Files Coverage Δ
panel/widgets/tables.py 84.97% <56.25%> (-0.57%) ⬇️
panel/models/tabulator.py 95.45% <57.14%> (-3.32%) ⬇️
panel/io/reload.py 69.23% <0.00%> (-2.20%) ⬇️
panel/tests/pane/test_plotly.py 98.15% <0.00%> (-0.62%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ee9df3b...a01e6b3. Read the comment docs.

@MarcSkovMadsen
Copy link
Collaborator

Wow. Some one thinks tables are important. I do too. Love it.

@philippjfr philippjfr merged commit 06869c5 into master Jan 18, 2022
@philippjfr philippjfr deleted the tabulator_buttons branch January 18, 2022 17:23
@MarcSkovMadsen
Copy link
Collaborator

I wondered about the use cases. I would say some very popular ones are "download file" and "open url". Are they easy to implement with these buttons @philippjfr ?

@maximlt
Copy link
Member

maximlt commented Jan 19, 2022

I've just tried it and the event returns the row number, not the row index. Which means that to get a value one has to write something like df.loc[df.index[event.row], 'URL']. Returning the row index might be a little simpler for users, or the whole row data.

@philippjfr
Copy link
Member Author

That's what we do for selections and the expanded parameter as well, you should just be able to use iloc like this: df.iloc[event.row]

@maximlt
Copy link
Member

maximlt commented Jan 19, 2022

I just find working with indexes usually more natural than working with row numbers but if this is what is already done elsewhere then let's favor being consistent. (This is concise enough anyway: df.iloc[event.row]['URL'])

@jbednar
Copy link
Member

jbednar commented Jan 19, 2022

Sounds like that iloc usage ought to be illustrated in the docs?

@contang0
Copy link

is there a way to move button position to the left of the table?

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

Successfully merging this pull request may close these issues.

5 participants