How to hide a button

How to hide a button

INTONEINTONE Posts: 153Questions: 58Answers: 6

I have asked this question already and and received an answer. see here:
http://datatables.net/forums/discussion/22187/how-to-hide-a-button#latest

However I had not actually tried to implement this until now and now I am seeing that with my limited JavaScript knowledge its not working at all. It is possible that a more complete working example could be provided?

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Based on what we discussed before:

    $('#ToolTables_example_4').css('display', 'none');
    

    Change the button id as appropriate for your use case.

    Allan

  • INTONEINTONE Posts: 153Questions: 58Answers: 6

    Thanks for your response, I have done what you suggested already with using css, I was hoping to get something a bit more solid using the array example you were giving...

     buttons = [ ... ];
    
     if ( userHasCreateAccess ) {
        buttons.unshift( { ... create button } );
     }
    

    but cant get it to work.

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    That looks like it should work fine to me. Can you link me to the page you are using or show me the actual code please?

    Allan

This discussion has been closed.