how to add a button for each row only if that particular row column value is owner

how to add a button for each row only if that particular row column value is owner

kasaranenisrikasaranenisri Posts: 4Questions: 2Answers: 0
edited May 2019 in Free community support

HI,

I have a datatable which have some 10 columns where the in one column returns the ID.I want to add the delete button to the row only if the ID ="Somevalue".Other wise delete button should not be present.

below is the code i have tried.

{
                 "data": "deleteBtn","orderable": false, "render": function(data, type, row, dataIndex) {
                    
                    if(data[7]== "e-1")
                    {
                     return '<center><a class="btn btn-action del" href=#>Delete</a></center>' }
                    }
             }

But its appearing for all the rows irrespective of the match with "e-1"

please help where i am doing wrong

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Hi @kasaranenisri ,

    At a glance that looks like it should work. We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.