Kendo:将远程日期源绑定到表单 [英] Kendo: bind remote datesource to form

查看:93
本文介绍了Kendo:将远程日期源绑定到表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图了解如何将数据从远程数据源绑定到表单,类似于

I am trying to understand how I can bind data from a remote datasource to a form, similar to this question, my ajax is returning the correct data.

我已经尝试实施建议的解决方案,但是它似乎没有用,也没有错误.

I have tried to implement the suggested solution but it doesn't appear to work and there are no errors either.

我的ajax请求:

$.ajax({
    url: "Read?messageID=" + "123456",
    method: "get",
    type: "application/json",
    success: function (result) {
        console.log(result);
    },
    error: function (result) {
        console.log(result);
    }

})

我不知道如何从读取的数据中提取响应并以我的简单形式显示它.

I do not know how to extract the response from the read data and display it in my simple form.

如果有人能给我一些指导,我将非常感激.我在SO和Telerik论坛上都读了很多文章,但是我还无法理解如何解决我的问题.

If anyone could kindly give me some pointers, I would be so grateful. I have read a lot of posts on both SO and the Telerik forums but I have not been able to understand how to overcome my problem.

非常感谢

这是我的表单字段:

@Html.Label("message", "Note:", new { @class = "form-label" })
<input id="messages" class="form-control k-textbox" data-bind="value:message" />

我需要添加一个viewModel吗?

Do I need to add a viewModel?

推荐答案

对于剑道数据源,这里是一个示例

For kendo Datasource here is a sample

    $.ajax({
    url: "Read?messageID=" + "123456",
    method: "get",
    type: "application/json",
    success: function (result) {
        var dataSource = new kendo.data.DataSource({
            data: result
        });
        console.log(result);
    },
    error: function (result) {
        console.log(result);
    }

});

这篇关于Kendo:将远程日期源绑定到表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆