博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Kendo template.

Posted on 2014-03-26 09:05  钟悍  阅读(1836)  评论(0编辑  收藏  举报
var template = kendo.template($("#singleItem").html());
var result = template(data);
$("#container").append(result);
<script type="text/x-kendo-template" id="singleItem">
# for (var i=0,len=data.length; i< len;i++){ var resultSegItem = data[i].goSegmentsStr; resultSegItem = resultSegItem.replace(/\"/g,"\'"); #
    <tr>
        <td><i class="manyCon"  data-list="#=resultSegItem#"></i></td>
        <td><span class="fontStyle-size14">#=data[i].departDate #</span></td>
    </tr>
#}#
</script>
$(".manyCon").kendoTooltip({
        position:"bottom", //left right top
        wrapperClass:"lineWeight",
        width:370,
        content:kendo.template($("#manyCon").html()),
        callout:false,
        offsetY:10
});
<script type="text/x-kendo-template" id="manyCon">
     # var list = eval( '('+ target.data('list') + ')' ); #
     # for (var i=1,len=list.length;i<len;i++ ) { #
          <span class="tran_air" style="min-width:319px;">
              #= list[i].departCity
          </span>
     #}#
</script>