How to make a column visible false in a table that includes buttons.

How to make a column visible false in a table that includes buttons.

kishormkishorm Posts: 1Questions: 1Answers: 0

Hello There! I am using DataTable in my asp.net project and have a table in a page. I have included buttons in last column of my table for edit and modify .I want to make that column visible fasle for special condition in the page load. Is it possible to take a parameter for button visibility from my code rather than making visibilty:false in script?? How to do that ??

Answers

  • colincolin Posts: 15,118Questions: 1Answers: 2,583

    Yep, you would just use the condition to make it false, something like

    let isVisible = condition? true : false;
    
    ...
    
    columnDefs: [{
        targets: 1,
        visible: isVisible,
    }]
    
    ...
    
    

    Colin

Sign In or Register to comment.