How to handle QTable row clicks?
See original GitHub issueHi Eli
I’m trying to react to a row click in a QTable (not row selection). With the code below I can observe that the click handler is called. So far so good. However I cannot find a way to know which row/item is clicked. The body slot is necessary to have the click handler installed. But I fear that a complete solution requires real ‘props’ (see #79). Or do you see a workaround?
TIA
Marcel
async def on_row_click(comp, msg):
print('ROW CLICK', msg)
body_slot = jp.QTr(
children=[jp.QTd(text='XX')],
click = on_row_click
)
self.grid = jp.QTable(a=self,
title='Suppliers',
style='width: 100%; margin: 0.25em',
columns=self.columns,
data=self.items,
separator='horizontal', # 'cell', 'none'
row_key='uuid',
selection="multiple",
# selected=self.selected_movies,
pagination=self.pagination,
top_slot=top_slot,
body_slot=body_slot,
)
Issue Analytics
- State:
- Created 3 years ago
- Comments:7
Top Results From Across the Web
Adding an onclick event to a table row - Stack Overflow
I create a table with a thead and tbody tags. And then add a click event to the tbody element by id. <script>...
Read more >Javascript Element How to - Handle click event for table row tr
We would like to know how to handle click event for table row tr. Answer. <!DOCTYPE html> <html> ...
Read more >Run - W3Schools Tryit Editor
<p>Click on each tr element to alert its index position in the table:</p> <table> <tr onclick="myFunction(this)"> <td>Click to show rowIndex</td>
Read more >How to make clickable table row Without adding OnClick to ...
1) Add a custom class to the table widget (jsClass) · 2) Define OnRender event handler to the respective screen · 3) Within...
Read more >Can a user click on a data table row to be taken t...
I understand that table rows are not editable and a gallery table would work better for including edit buttons and whatnot.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think it mostly comes down to personal preference. So my take:
The free version of ag-grid comes with quite a few features that QTable does not have. For example: Allowing users to filter fields and allowing pinned columns. Ag-grid also supports more events and simpler cell editing.
As @mjmare says, QTable has flexibility that is no supported by JustPy (I’m working on this). Ag-grid is currently more flexible as you can put html in the cells.
In the end, it depends on the features you need.