how to add buttons depending on the column value?

how to add buttons depending on the column value?

Sergio ProtechSergio Protech Posts: 22Questions: 4Answers: 0

what im trying to do is :`
Depending on the description column value, which would be include exclude or sth random, i would like those button to appears as in the figure. Which means, if the description value is exclude, only include button should appear, if the description value is include only exclude button should appear, and if it is sth else one random of them both shoud appear. What i have done is shown below but the problem is that both buttons appear each time on reload and i do not want that

Answers

  • kthorngrenkthorngren Posts: 20,276Questions: 26Answers: 4,765

    Possibly you can use columns.render to display the appropriate buttons. See this example.

    Kevin

  • Sergio ProtechSergio Protech Posts: 22Questions: 4Answers: 0

    @kthorngren i have used render function

  • Sergio ProtechSergio Protech Posts: 22Questions: 4Answers: 0

    this is how i handle the toggle, but its not working...

  • kthorngrenkthorngren Posts: 20,276Questions: 26Answers: 4,765

    I'm not sure what the goal of the .exclude click event is but the show() and hide() aren't going to work. First it will apply to all rows shown and second it will be overwritten with the ajax.reload() process.

    Depending on the description column value, which would be include exclude or sth random, i would like those button to appears as in the figure.

    Use an if statement in the columns.render function to determine which buttons to display. The row parameter will contain the data for the row including the Description column.

    Kevin

Sign In or Register to comment.