knockout.js - Column name condition when dynamically binding grid in knockout -


i having following tbody dynamic rows , columns:

 <tbody data-bind="foreach: clientlistingdata">         <tr>             <!-- ko foreach: $parent.orderedcolumns -->             <!-- if: $parent[orderedcolumns] == 'clientid' -->             <td class="greenbg">                 <span data-bind="text:  $parent[$data]"></span>             </td>             <!-- /ko -->             <!-- if: $parent != 'clientid' -->             <td>                 <span data-bind="text:  $parent[$data]"></span>             </td>             <!-- /ko -->             <!-- /ko -->         </tr>     </tbody> 

clientlistingdata contains entire grid data in json format , orderedcolumns array object containing column name [clientid,clientname..etc] usng dynamically bind grid. requirement when column name clientid want td have different css class trying above. how can read name of column using if binding , using orderedcolumns array? possible nest conditions using if binding in example?like if clientid greater 10, want td have orange background , if greater 100, td should have red background.

there's binding css

http://knockoutjs.com/documentation/css-binding.html

<div data-bind="css: { profitwarning: currentprofit() < 0 }">    profit information </div>  <script type="text/javascript">     var viewmodel = {         currentprofit: ko.observable(150000) // positive value, don't apply "profitwarning" class     };     viewmodel.currentprofit(-50); // causes "profitwarning" class applied </script> 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -