0

I have a table header where I am showing Icon based on radio value click on row.

So, default it is AddIcon where onClick I would add one more row to the table and if I click any row then I am showing EditIcon and DeleteIcon simultaneously.

But how do I switch back to AddIcon since I am having radioValue already selected therefore I want listen click listener except this div so that I can set state of radio value again.

Kramer
  • 389
  • 8
  • 34
  • add functionality so that when you click on the already selected row it clears the selection. – Gabriele Petrioli Jan 30 '19 at 09:15
  • @GabrielePetrioli exactly I thought the same thing but then it would not be called a radio button. Have you seen a radio button where you click on it then it would deselect the selection made? – Kramer Jan 30 '19 at 09:17

1 Answers1

0

add handler function that toggle between true and false whenever you click ?

Ariel Livshits
  • 591
  • 1
  • 7
  • 23
  • yes but how do make a listener which will listen all click events except to this table? This is my problem. Then I will add handler to set radioValue – Kramer Jan 30 '19 at 09:15
  • what do you mean all click events ? – Ariel Livshits Jan 30 '19 at 09:17
  • all click events sounded little weird what I meant here is if I click anywhere else except on the div in which I am having table I want to set some value by calling a function – Kramer Jan 30 '19 at 09:19
  • https://stackoverflow.com/questions/12661797/jquery-click-anywhere-in-the-page-except-on-1-div – Kramer Jan 30 '19 at 09:21
  • https://stackoverflow.com/questions/35328016/click-on-body-except-on-specific-div/35328119 this one is more appropriate something like this `$("body").not($("#menutop"))` – Kramer Jan 30 '19 at 09:22
  • I want the same thing in reactjs not jquery – Kramer Jan 30 '19 at 09:34
  • i don't thing that this way is best practice , i really don't recommend it – Ariel Livshits Jan 30 '19 at 13:54
  • https://material-ui.com/demos/tables/#tables Look here the tables where checkboxes are mentioned I replaced these checkboxes with radio button therefore how deselect the radio button. The question is pretty simple. – Kramer Jan 30 '19 at 13:56
  • Maybe I don't get what you have done , pls add some code... For me it's sound just as toggle function – Ariel Livshits Jan 30 '19 at 15:24