Javascript 获取未捕获错误:无法分析敲除中的绑定

Javascript 获取未捕获错误:无法分析敲除中的绑定,javascript,jquery,knockout.js,Javascript,Jquery,Knockout.js,犯错误 Uncaught ReferenceError: Unable to parse bindings. Bindings value: html: typeof rowText == 'function' ? rowText($parent) : $parent[rowText] , attr: {class: [rowText]} Message: $parent is not defined 在 \ \ \ \ \ 用td标签替换span后,其工作正常 <tbody

犯错误

Uncaught ReferenceError: Unable to parse bindings.
Bindings value: html: typeof rowText == 'function' ? rowText($parent) : $parent[rowText] , attr: {class: [rowText]}
Message: $parent is not defined

\
\
\
\
\
用td标签替换span后,其工作正常

    <tbody data-bind=\"foreach: itemsOnCurrentPage\">\
         <tr data-bind=\"foreach: $parent.columns, attr: {id: ItemId},css:{even:$index()%2==0,odd:$index()%2!=0}\">\
             <td data-bind=\"html: typeof rowText == 'function' ? rowText($parent) : $parent[rowText] , attr: {class: [rowText]}\"></td>\
          </tr>\
     </tbody>\
\
\
\
\
\

不知怎的,我需要那边的span标签。任何人都可以告诉我,如果使用td标签,为什么绑定时会显示错误。下面是一个示例

您不能将span直接放在'tr'下,它必须在td内,这就是为什么会出现错误。所以把跨度放在td下面

 <tbody data-bind="foreach: itemsOnCurrentPage">
    <tr data-bind="foreach: $parent.columns">
           <!--ko ifnot: typeof rowText == 'object' && typeof rowText.action == 'function'-->
          <td> 
            <span data-bind="text: typeof rowText == 'function' ? rowText($parent) : $parent[rowText] "></span>
         </td>
        <!--/ko-->
     </tr>
  </tbody>

能否显示您的viewmodel代码?
 <tbody data-bind="foreach: itemsOnCurrentPage">
    <tr data-bind="foreach: $parent.columns">
           <!--ko ifnot: typeof rowText == 'object' && typeof rowText.action == 'function'-->
          <td> 
            <span data-bind="text: typeof rowText == 'function' ? rowText($parent) : $parent[rowText] "></span>
         </td>
        <!--/ko-->
     </tr>
  </tbody>
 Start tag span seen in table.//error invalid html