Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

233
Views
How to disable button in KO JS after some event happens?

I'm trying to enable disabled button after I load a table on the page.

self.uploadPdfButtonIsEnabled = false;
self.pricingTableRenderedHandler = function (data, stateName) {
        self.uploadPdfButtonIsEnabled = true;

        //some other irrelevant logic
}

.cshtml file

 <button class="button button--primary" id="uploadPdfsButton" data-bind="click: $root.openPdfUpload, enable: uploadPdfButtonIsEnabled">
      <span class="button__text">Upload PDF</span>
 </button>

As a result, I only get this button disabled and it is not enabled. Tried to debug and the pricingTableRenderedHandler is entered, uploadPdfButtonIsEnabled becomes true but the button is still disabled

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You have to use an observable for the knockout binding to be able to update automatically:

// Pass the initial value: `false`
self.uploadPdfButtonIsEnabled = ko.observable(false);
self.pricingTableRenderedHandler = function (data, stateName) {
  // Update by calling with the new value: `true`
  self.uploadPdfButtonIsEnabled(true);
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!