ListView数据显示在KendoUI中未定义

时间:2017-09-11 05:15:16

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

HTML Code ..我正在努力学习,因此我使用了示例代码

<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> 

parameterMap:

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);
}

因此,我获得了第一行的数据,但是为了休息它显示的所有行&#34; unidentified&#34;

1 个答案:

答案 0 :(得分:0)

我得到了答案

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