Kendo UI& Angularjs:使网格内联可编辑

时间:2014-04-29 13:35:36

标签: javascript html angularjs kendo-ui kendo-grid

我已根据本指南在angularjs中集成了kendo ui:Angular Kendo UI

现在我想让我的网格内联可编辑。在angularjs控制器中我有:

gestionale.controller('mainController', function ($scope, $http) {

   $scope.products = new kendo.data.DataSource({
       transport: {
           read: {
               url: "api/Personale",
               dataType: "json"
           }
       },
   });
});

在HTML页面中:

<div kendo-grid k-data-source="products" k-selectable="'row'" k-sortable="true" k-toolbar ='["create"]'
     k-columns='[
{ "field": "Nome", "title": "Nome"},
{ "field": "Cognome", "title": "Cognome"},
{ "field": "Cellulare", "title": "Cellulare" },
{ command: ["edit", "destroy"], title: "", width: "172px" }
 ]' k-editable="inline" style="height: 365px">
</div>

使用此代码正确填充网格,我可以看到编辑和删除按钮但是,当我单击编辑按钮时,该行不会进入内联编辑模式(当我单击编辑按钮时,刷新页面。)

如何获得内联编辑模式? 感谢

1 个答案:

答案 0 :(得分:2)

您应该如何定义k-editable

<div kendo-grid k-data-source="products" k-selectable="'row'" k-sortable="true" k-toolbar ='["create"]'
     k-columns='[
{ "field": "Nome", "title": "Nome"},
{ "field": "Cognome", "title": "Cognome"},
{ "field": "Cellulare", "title": "Cellulare" },
{ command: ["edit", "destroy"], title: "", width: "172px" }
 ]' k-editable='{"mode": "inline", "create": true, "update": false, "destroy": true}' style="height: 365px">
</div>