Why e.model.isNew() is not a function ?

1 Answer 15 Views
Grid
Erka
Top achievements
Rank 1
Erka asked on 30 Dec 2021, 05:31 PM
Hi everybody,

I post today because i have this code and my edit function return me "e.model.isNew() is not a function"... i don't know why ? :

$("#table-luminaire").kendoGrid({
          dataSource: {
            data: ares
          },
          editable: {
            confirmation: "blabla ?",
            mode: "incell"
          },
          toolbar:["excel", "create", "save"],
          sortable: true,
          columnMenu : true,
          resizable : true,
          pageable: {
              refresh: true,
              pageSizes: true,
              buttonCount: 5,
              pageSize: 20,
          },
          columns: [{
              field: "ID",
              title: "ID",
              hidden:true,
          }, {
              field: "CATEGORIE",
              title: "Cat├ęgorie",
              width: 135,
              editable: function() {return array_decode.includes("CATEGORIE");}
          }, {
              field: "CODE_INSEE",
              title: "Code INSEE",
              width: 140,
              editable: function() {return array_decode.includes("CODE_INSEE");}
          },
          { command: ["edit", "destroy"], title: " ", width: "250px"}
          ],
          edit: function (e) {
              console.log(e)
            if (e.model.isNew()) {
                console.log('model')
            }
          },
          save: function(e) {
            console.log(e.values);
          },
          saveChanges: function(e) {
            console.log('ok save')
          },
          schema: {
            model: {
              id: "id"
            }
          },
        });

If someone have an idea ... Thank you in advance for your answers,

Erka

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 03 Jan 2022, 01:45 PM

Hello Erka,

This error occurs as the data source is not configured for editing but is rather locally bound to an array. Below I am posting an article on how to set the data source  CRUD Data Operations

I have prepared a runnable Dojo demo demonstrating the above:

Regards,
Nikolay
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
Erka
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or