【问题标题】:ListView data showing undefined in KendoUIKendoUI 中显示未定义的 ListView 数据
【发布时间】:2018-02-19 06:37:12
【问题描述】:

HTML 代码.. 我正在为学习目的而工作,因此我使用了示例代码

<script type="text/x-kendo-tmpl" id="template">
    <div class="product-view k-widget">
        <dl>
            <dt>  Title  </dt>
            <dd>  #:Title#   </dd>
            <dt>  Deetail  </dt>
            <dd>  #:Deetail#   </dd>
        </dl>
    </div>
</script> 

参数映射:

else if (operation !== "read" && options.models) {                                        
    return { models: kendo.stringify(options.models)
};

JavaScript:

var listView = $("#listView").kendoListView({
    dataSource: dataSource,
    template: kendo.template($("#template").html()),
    editTemplate: kendo.template($("#editTemplate").html())
}).data("kendoListView");`

API 调用:

read: {
    type: "GET",
    url: "XYZ"+value,
    dataType: "json",
    cache: false
},

控制器代码:

public IHttpActionResult GetSpecificationDetail(int id)
{
    Type type= new Type();
    List<Type> spdetails = db.Type.Where(i => i.typeId == id).ToList();
    if (spdetails == null)
    {
        return NotFound();
    }
    return Ok(spdetails);
}

因此,我获得了第一行的数据,但其余所有行显示“未识别”

【问题讨论】:

    标签: javascript jquery html model-view-controller kendo-ui


    【解决方案1】:

    我得到了答案

    var spdetails = db.TypeDetails.Where(i => i.TypeId == id).Select(s=> new TypeDetailsView{ TypeId=s.TypeId,Details=s.TypeDetails,TypeTitle=s.TypeTitle}) .ToList();

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-26
      • 2019-10-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多