material-table icon indicating copy to clipboard operation
material-table copied to clipboard

Invoking a click handler on row selection

Open aswamina opened this issue 7 years ago • 9 comments

Is there a way to invoke a handler function when clicking on a row in the table ? The Selection example of using the onSelection does not seem to invoke the handler.

aswamina avatar Jan 10 '19 05:01 aswamina

onSelectionChange event only invove if you set selection true in options.

mbrn avatar Jan 10 '19 06:01 mbrn

But selection true causes a checkbox to appear. I don’t want the checkbox but want to click anywhere on the row and have a modal popup that prompts me for a confirmation of action .

aswamina avatar Jan 10 '19 11:01 aswamina

This is new feature for us. I will work on this. But i am very busy nowadays. I can do this later.

Why don't you fork the project for first contribute:)

mbrn avatar Jan 10 '19 11:01 mbrn

Is there no way, even by using a render function to invoke a div with an onClick handler ?

aswamina avatar Jan 11 '19 04:01 aswamina

It is not efficient way. Because you should apply same to all columns.

Why you don't use actions? https://mbrn.github.io/material-table/#/docz-examples-03-example-actions

mbrn avatar Jan 11 '19 04:01 mbrn

The UX design calls for just a row with no checkboxes or radio buttons or icons. The design asks for clicking on a row to launch an alert dialog where the user confirms with a YES or NO. I can try to talk to the product team.

On Thu, Jan 10, 2019 at 8:27 PM Mehmet Baran [email protected] wrote:

It is not efficient way. Because you should apply same to all columns.

Why you don't use actions? https://mbrn.github.io/material-table/#/docz-examples-03-example-actions

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mbrn/material-table/issues/150#issuecomment-453374511, or mute the thread https://github.com/notifications/unsubscribe-auth/AIva_RPPpUnDyeviA5kd2RF5fWkBues5ks5vCBLMgaJpZM4Z4ztu .

-- Anand Swaminathan

aswamina avatar Jan 11 '19 04:01 aswamina

Hi, Thank you for this great lib, I have made a small pull request to handle the row click. I hope you can accept it.

Thank you very much.

slevy85 avatar Jan 16 '19 20:01 slevy85

Hi, Thank you for this great lib, I have made a small pull request to handle the row click. I hope you can accept it.

Thank you very much.

Thank you @slevy85 . I accepted it. After i test it, it will be in next release in a few days.

mbrn avatar Jan 17 '19 06:01 mbrn

I fixed some minor thing. I will publish new release today. Thanks for your clear code @slevy85

mbrn avatar Jan 23 '19 08:01 mbrn