Kendo ui 具有自定义编辑模板的kendo listview-无法更改模型值

Kendo ui 具有自定义编辑模板的kendo listview-无法更改模型值,kendo-ui,kendo-grid,Kendo Ui,Kendo Grid,我有一个带有自定义编辑模板的剑道列表视图 这是列表视图代码 var warrantyContact_listview = $("#warrantyContact_listview").kendoListView({ autoBind: false, dataSource: dataSource, template: kendo.template($("#warrantyContact_listview_template").html()),

我有一个带有自定义编辑模板的剑道列表视图

这是列表视图代码

var warrantyContact_listview = $("#warrantyContact_listview").kendoListView({
        autoBind: false,
        dataSource: dataSource,
        template: kendo.template($("#warrantyContact_listview_template").html()),
        editTemplate: kendo.template($("#warrantyContact_editview_template").html())
    }).data("kendoListView");
这是编辑模板代码

<script type="text/x-kendo-tmpl" id="warrantyContact_editview_template">
    <div id="con_editview">        
    <dd>
    <dt>Person</dt>
    <input type="text" 
    data-role = "autocomplete" 
    data-source = "some_datasource" 
    data-text-field = "fname"  
    data-value-field = "bid"
    class="k-textbox" 
    data-bind="value:some_value" 
    name="builder" 
    required = "required"
    validationMessage = "required"  
    id="builder"/>
    <span data-for="some_value" class="k-invalid-msg"></span>
    </dd><br clear="all"/>                       

    <dt>City</dt>
    <dd>
    <input type="text" class="k-textbox" data-bind="value:city" name="city" required = "required" validationMessage = "required" />
    <span data-for="city" class="k-invalid-msg"></span>
    </dd><br clear="all"/>

    <dt>State</dt>
    <dd>
    <input type="text" name = "state" class="k-textbox"  data-bind = "value:state" data-value-field="abbrev" data-text-field="abbrev" data-min-length="1" data-source="states_datasource" data-role="autocomplete" required = "required" validationMessage = "required" />
    <span data-for="state" class="k-invalid-msg"></span>
    </dd><br clear="all"/>

    <dt>Zip</dt>
    <dd>
    <input type="text" class="k-textbox" data-bind="value:zip" name="zip" required = "required" validationMessage = "required" />
    <span data-for="zip" class="k-invalid-msg"></span>
    </dd><br clear="all"/>

    </dl>
    </div>
</script>  

城市
陈述
拉链
下面是一个场景

当listview进入编辑模式时,我会填写第一个字段“Person”,这是一个自动完成的字段

根据我为自动完成“Person”选择的值,我想将其相应的值分配给城市、州和邮政编码。我能够成功地分配值。(我在Person Auto complete的select事件中使用jquery ajax执行此操作)

但是,当我调用
$(“#warrantyContact_listview”).data(“kendoListView”).save()时

当我检查firebug控制台时

更改后的值city、state和zip不会传递给服务器端

我错过了什么

我必须在这里更改模板中值的绑定吗

我试图更改参数映射函数中的值,但没有成功


任何帮助都将不胜感激

我的第一个猜测是,当您更改值时,您不使用in数据源,因此剑道数据源不知道可观察的字段被修改。 因此,在save()(为数据源调用sync())上,它不会看到任何新内容,也不会更新任何内容


手动检查数据源,使用set()更改某些内容,然后使用save()查看是否已保存。

谢谢!这就是问题所在:)您也应该处于编辑模式(即grid.edit(row))。可能会遇到此问题,因为他们在未处于编辑模式时根据某些外部条件手动编辑了值并尝试保存。网格的可编辑属性将是未定义的,保存将不起任何作用。您如何设置输入中的值?我在模型及其集合中设置了值,但输入仍然为空。你能分享代码片段吗?