kendo ui AngularJS Grid CRUD操作

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了kendo ui AngularJS Grid CRUD操作相关的知识,希望对你有一定的参考价值。

我正在尝试使用angularjs实现kendo ui网格的弹出编辑器。编辑我的记录工作正常但添加新记录似乎是将数据值字段作为[对象对象]发送。我似乎无法弄清楚这一点。

这是我在控制器中的数据源:

$scope.tempDataSource = '[{"value": 7,"text": "fdsdd - dsfdsfdsf"},{"value": 6,"text": "sads - sadsa"},{"value": 5,"text": "dsf - dsfdsf"},{"value": 2,"text": "dsf - sdfdsfds"}]';

这是我的下拉列表:

<input name="AppName"
                   data-bind="value:projId"
                   data-value-field="value"
                   data-text-field="text"
                   data-source="{{tempDataSource}}"
                   data-role="dropdownlist" />

正如我所提到的,网格记录编辑工作正常。它是一个添加记录,它将值作为[object Object]发送

答案

你为什么要传球?你能这样试试吗:

$scope.tempDataSource = [{"value": 7,"text": "fdsdd - dsfdsfdsf"},{"value": 6,"text": "sads - sadsa"},{"value": 5,"text": "dsf - dsfdsf"},{"value": 2,"text": "dsf - sdfdsfds"}];

并在html中:

<input name="AppName"
                   data-bind="value:projId"
                   data-value-field="value"
                   data-text-field="text"
                   data-source="tempDataSource"
                   data-role="dropdownlist" />

以上是关于kendo ui AngularJS Grid CRUD操作的主要内容,如果未能解决你的问题,请参考以下文章

Kendo UI Grid 尝试使用以下配置选择行

Kendo UI Grid:如何使单元格在条件下只读

Kendo Grid 和 ui-sref 向上取整数字

Kendo UI Angular Grid NumberFormatOptions

Kendo UI Grid 根据其数据类型为列提供不同的模板

如何在 kendo.ui.grid 中创建自定义 kendo.ui.Window 以进行编辑