Change button text in a table
Change button text in a table
I have a situation that is similar to the following example https://datatables.net/examples/ajax/null_data_source.html
But when I click the button amongst other things I want to change the text the button shows. Specifically I want it to flip between Show and Hide. Seems simple enough, but I'm having real trouble just getting the text in the button to check which it is? How can this be done?
Note I suppose I could just have another array that flags the current value in the text (a boolean would do) and check that, but then I'd still need to be able to set the text in the button.
I could also use two images but I'd rather have buttons.
Thanks
Answers
I can easily tell is the button should say Show or Hide based on the row.child.isShown property, but how do I change the text on the button for just this instance?
Solved...
Inside the if(row.child.isShown) adjust the innerHtml of the button and similarly in the else e.g. using the above linked example