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.

How to handle QTable row clicks?

See original GitHub issue

Hi 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:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
mjmarecommented, Aug 19, 2020

I think it mostly comes down to personal preference. So my take:

  • the interesting features in ag-grid require a paid license.
  • QTable is part of the Quasar framework, which is awesome IMHO. If you use Quasar already, QTable is the natural choice.
  • Quasar and therefore QTable is Vue.js based
  • QTable is very flexible when used as a Vue component. Justpy currently has limitations that prevent using all this flexibility.
1reaction
elimintzcommented, Aug 19, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

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