0

我有以下淘汰赛绑定和 javascript

<table id="tblall" border="0" class="table table-hover" width="100%">
<tbody data-bind="foreach: myinfo">
<tr id="Tr1" style="cursor: pointer" > 
 <td data-bind="click: $parent.selectIt, css: { 'red': $parent.isSelected == $data } "></td>
<td data-bind="text: $parent.isSelected"></td>
</tr>
</tbody>
</table>

和这个 javascript

function (logger, system, router) {
var isSelected = ko.observable();
---
---
-
--
    var vm = {
             isSelected:isSelected,
        selectit: function(row, event) {

               isSelected(row.id);

            }

当我选择一行时,它正在改变 isselected 但css永远不会改变。

4

1 回答 1

0

我觉得是对比

$parent.isSelected == $data

$data将包含一个myinfo对象,无论它看起来像什么

您没有将字符串数组绑定到表格,是吗?

于 2013-07-22T21:03:17.017 回答