AngularJS Kendo网格内联更新和删除

时间:2018-09-03 08:54:00

标签: angularjs kendo-grid

我在网格中填充了API数据。当我单击“编辑”按钮时,所有字段均进入编辑模式,而当我单击“更新”按钮时不起作用。如何进行更新以及如何传递ID以使删除按钮起作用?有人可以帮我吗?

//my HTML page
<kendo-grid options="gridOptions"></kendo-grid>

 //js

 $scope.gridOptions = {       
            columns: [          
                {  title: "Name",field:"name" },
                {  title: "Display Name" ,field:"display_name"},
                { title: "address",field:"address"},
                {  title: "telephone",field:"telephone" },

                { title: "website",field:"website"},
                { command: ["edit", "destroy"], title: "&nbsp;", width: "170px" }

            ], 

            dataSource:{
               data:this.products,

               transport:{
                        read:{
                                url:    "http://localhost:8000/api/generic/company/get"  
                            }, 
                        update:{
                                url:    "http://localhost:8000/api/generic/company/modify"  
                            },   
                        destroy:{
                                url:    "http://localhost:8000/api/generic//generic/company/delete/'"+id+"'"  
                            }, 
               }   


            },
            // schema: {
            //     model: {
            //         id: "id",
            //         fields: {
            //             name: { editable: false, nullable: true },
            //             display_name: { validation: { required: true } },
            //             telephone: { type: "number", validation: { required: true, min: 1} },                      
            //             mobile: { type: "number", validation: { min: 0, required: true } }
            //         }
            //     }
            // },
            editable:"inline",
            height:500,  
            scrollable:true,
            pageable:true,
            pageable: {
                pageSize: 10,
                refresh: true
              },
            sortable:true,
            groupable:true,

      };
    }]);

0 个答案:

没有答案