0

是否可以强制空单元格不在模板中显示?

目前我的模板是:

template = kendo.template("#if (title != null){#<span class=\"box favorable\">50</span><div class=\"title\">${ title }</div>#}else{}#");

但是,如果else调用该语句,它只会显示一个空单元格。我希望不显示该单元格,而不是一个空单元格。

4

1 回答 1

0

您需要在模板中包含表格才能完全控制它。例如,在您的情况下,您需要这样的方法:

template = kendo.template("
  <table>
    # for (var i=0; i<rows.length;i++) { #
      #if (title != null){#
        <tr><td>
          <span class=\"box favorable\">50</span><div class=\"title\">#= title #</div>
        </td></tr>
      #}#
    # } #
  </table>
");
于 2013-09-01T01:02:30.407 回答