Home > DeveloperSection > Forums > How to Hide a table row with knockout style binding
Goti Bandu

Total Post:119

Posted on    January-06-2015 10:40 PM

 ASP.Net JavaScript  ASP.NET MVC  Knockout.js 

 1 Reply(s)
 1408  View(s)
Rate this:

I want to bind the display-style of a table row with knockout.js to a viewmodel property. I have to use the binding, because I want to hide or show the table row depending on other properties in my viewmodel.

Sample HTML code:

<tr data-bind="style: myProperty">



The viewModel:

this.myProperty = ko.computed(() => {

    return "{ display: none }";


But this doesn't work. The property is entered after loading the page, but the table row is still displayed. Is there another way to do this or did I forgot something?


Jeet Verma
Jeet Verma

Total Post:110

Posted on    January-06-2015 10:58 PM

You should use "visible" binding instead. More details here

Your example may looks like:

<tr data-bind="visible: myProperty">




Don't want to miss updates? Please click the below button!

Follow MindStick