title: Enabling custom button (disabled by default) when row is selected
body: <p>I have a DataTable displaying data for Branches with two custom buttons defined: Add and Update. They are initialized at the top of the Javascript section</p>
  
  <pre><code>var buttons;
  var tblBranch;
  
  $.fn.dataTable.ext.buttons.add = {
              className: 'button-add',
              text: "Add Branch",
              action: function (dt) {
                  onBtnAddClicked()
              }
          };
  
  $.fn.dataTable.ext.buttons.update = {
              className: 'button-update',
              text: "Update",
              action: function (dt) {
                  onBtnUpdateClicked()
              }
          };
  </code></pre>
  
  <p>I'd like to disable the Edit button on page load and only enable it to be clickable when a row has been selected. Problem is, I'm using custom buttons and I can't find anything on datatables.net about how to enable/disable them depending on conditions. So far what I've tried is this:</p>
  
  <pre><code>tblBranch = $("#tblBranches").DataTable({
          dom: 'Blfrtip',
          buttons: {
              buttons :[
                  'add', 'update'
              ]
          }
          select: true;
  })
  
  $("#tblBranches tbody").on('click', 'tr', function () {
          if (tblBranch.row(this).hasClass('selected')) {
               $('button-update').removeClass("DTTT_disabled");
          }
          else {
               table.$('tr.selected').removeClass('selected');
               $('button-update').addClass("DTTT_disabled");
          }
  });
  </code></pre>
  
  <p>But I don't know what the code to disable the Edit button when the page loads should be like, and I've looked <a href="https://datatables.net/forums/discussion/24952/disable-buttons-when-no-rows-selected" rel="nofollow noreferrer">here</a>, <a href="https://stackoverflow.com/questions/34573773/datatables-buttons-enable-disable-example-not-working">here</a>, <a href="https://stackoverflow.com/questions/23782527/how-to-disable-a-datatables-tabletools-button">here</a> and <a href="https://datatables.net/reference/api/buttons().disable()" rel="nofollow noreferrer">here</a>.</p>
  
  <p>Thanks for any guidance.</p>