Button Status

Button Status

Hildeb67Hildeb67 Posts: 83Questions: 23Answers: 1

Hello everyone,
I want to read the status of the button at the front in a line. Whether it contains a plus or minus sign. Is that possible?

Greetings, Chris

Answers

  • kthorngrenkthorngren Posts: 21,982Questions: 26Answers: 5,076

    It is possible. Use cell().node() to get the td then use jQuery or Javascript methods to parse the button to get the plus or minus status. If you need specific help with this then please provide a simple test case showing how the buttons are built into HTML so we can offer more specific suggestions.

    Kevin

  • Hildeb67Hildeb67 Posts: 83Questions: 23Answers: 1

    a test case is not possible to create because it is an online project
    this is how the button is triggered

            tablefzg.on('click', 'button', function (e) { 
                var action = this.className;
    
                if (action=='GetFZG'){                                                  
                    if (this.innerHTML == '-') {
                        this.innerHTML = "+";                   
                        this.style.backgroundColor = '#F0F0F0';     
                         
                    } else if (this.innerHTML == '+') {               
                        this.innerHTML = "-";                                           
                        this.style.backgroundColor = '#60c724';                         
                    }
                }
            })  
    

    Are there any examples of this?

    Chris

  • kthorngrenkthorngren Posts: 21,982Questions: 26Answers: 5,076

    Does that code work?

    The best thing to do is to start with this template:
    https://live.datatables.net/

    Refactor the template to show the buttons in the first column. Add your click event handler and provide details of what isn't working and what you want the event handler to do.

    This will allow us to see exactly what you have and what isn't working so we can offer specific suggestions.

    Kevin

  • Hildeb67Hildeb67 Posts: 83Questions: 23Answers: 1

    Kevin I wrote you a private email

Sign In or Register to comment.