When using angular-kendo.js with Kendo UI grid, edited values may not appear if the field is defined within the schema or model

After updating the FirstName in the following example, it does not display the changes. However, removing the FirstName field from the dataSource.schema.model shows the updates.

Before Edit

Edit

After Edit

In the Chrome Developer extension for Kendo UI, I noticed that when I remove the firstName property from the model, a new "model" property is added to the record instead:

data: Array[7]
    0: Object{3}
        Id: 1
        LastName: "ln_1"
        models: Array[1]
            0: Object{3}
                Id: 1
                FirstName: "fn_1_changed_to_something_else"
                LastName: "ln_1"
    1: Object{3}
        Id: 2
        FirstName: "fn_2"
        LastName: "ln_2"
        ....

What Could Be The Issue?

Example HTML Page

<!doctype html>
<html ng-app="demoApp">
<head>
    <meta charset="utf-8">
    <title>Kendo UI directives for AngularJS</title>
    <link href="//cdn.kendostatic.com/2014.1.318/styles/kendo.common.min.css" rel="stylesheet" type="text/css" />
    <link href="//cdn.kendostatic.com/2014.1.318/styles/kendo.silver.min.css" rel="stylesheet" type="text/css" />
    <script src="//code.jquery.com/jquery-1.9.1.min.js"></script>
    <script src="//cdn.kendostatic.com/2014.1.318/js/kendo.all.min.js"></script>
    <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js"></script>
    <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-route.js"></script>
    <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-sanitize.js"></script>
    <script src="/Scripts/angular-kendo.js"></script>
    <script>
        var demoApp = angular.module("demoApp", ["kendo.directives"]);
        demoApp.controller('demoCtrl', function($scope) {
            $scope.employees = [
                { Id: 1, FirstName: "fn_1", LastName: "ln_1" },
                { Id: 2, FirstName: "fn_2", LastName: "ln_2" },
                { Id: 3, FirstName: "fn_3", LastName: "ln_3" },
                { Id: 4, FirstName: "fn_4", LastName: "ln_4" },
                { Id: 5, FirstName: "fn_5", LastName: "ln_5" },
                { Id: 6, FirstName: "fn_6", LastName: "ln_6" },
                { Id: 7, FirstName: "fn_7", LastName: "ln_7" }
            ];

            $scope.mainGridOptions = {
                dataSource: {
                    data: $scope.employees,
                    batch: true,
                    pageSize: 5,
                    schema: {
                        model: {
                            id: "Id",
                            fields: {
                                FirstName: { type: "string", validation: { required: true } }
                                //LastName: { editable: true }
                            }
                        }
                    }
                },
                editable: "popup",
                sortable: true,
                pageable: true,
                columns: [{
                    field: "FirstName",
                    title: "First Name",
                    width: "120px"
                }, {
                    field: "LastName",
                    title: "Last Name",
                    width: "120px"
                },
                {
                    command: [{
                        name: "edit",
                        text: { edit: "Custom edit", cancel: "Custom cancel", update: "Custom update" }
                    }
                    , { name: "destroy", text: "Remove" }
                    ]
                }]
            };
        });
    </script>
</head>
<body ng-controller="demoCtrl">
    <div>
        <div kendo-grid k-options="mainGridOptions"></div>
    </div>
</body>
</html>

Answer №1

The issue has been identified: It is recommended to avoid utilizing the datasource batch parameter when dealing with local data.

This was confirmed by Mihai Bazon.

Once I switched the batch option to false, everything started functioning properly once more.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to add a change event to a textarea that is already applied with a filtered one-way binding?

I have a text area that is already linked with a filter, so it will display the correct information when the page loads. Now, I want to update a model when the text area content changes. However, when I add a model and change event, the initial binding sto ...

Guide to routing all express pages to distinct pages (Without using the .html extension)

I have multiple pages stored in my static-content folder: index.html about.html dashboard.html Is there a way to route these pages without including .html in the URL? I'm looking for a solution that doesn't involve creating separate routes for e ...

Navigating within a mapping array

I am attempting to create a nested map within a looped map. However, as this is my first time using JavaScript, I am finding it a bit challenging to use the correct tags. My goal is to create a table where the first row displays the category and the second ...

Error encountered using Meteor 1.3 autoform/quickform integration

Having recently transitioned to using Meteor 1.3, I've encountered a few challenges related to debugging due to missing imports or exports in tutorials. This particular issue seems to be in the same vein. I wanted to incorporate the autoform package ...

Clickable CSS3 animations

Currently exploring the fundamentals of CSS3 animation and onclick events, but I've hit a roadblock. My objective is to utilize button id="3" to initiate the animation on the red square displayed here: https://jsfiddle.net/4swmegpn/ Additionally, I a ...

Sending a jsp page for review at specified intervals

Using the setTimeout method, I attempted to achieve this. I passed a variable containing time as an argument, but the setTimeout method is only taking the initialized value of that variable and not the updated value fetched from the database. Below is the ...

Choosing the Active Browser Tab while Modal is Open in Angular

In my current situation, I have implemented a function in the first tab that displays a modal or component after 5 seconds: ngOnInit() { setTimeout(() => { this.openDialog(); }, 5000); } openDialog() { this.dialog.open(.....); } However, if ...

Transition from traditional class-based components to functional components

I am utilizing the ref from the parent class to access the child class. However, in this scenario, I want to access the child functional component from the parent class. In the parent class: class Waveform extends Component { constructor(props){ s ...

Accessing a key from an AJAX JSON response and applying it within a .each() loop in jQuery

I'm struggling with a seemingly simple task that I just can't seem to get right. My goal is to convert multiple text inputs into select fields using AJAX and jQuery. Everything works smoothly, except when trying to make the $.each function dynam ...

I encountered an issue with displaying a fullcalendar within a pop-up modal

Hey there! I'm facing an issue with setting up a fullcalendar inside a bootstrap modal. When I do so, the calendar appears compressed in the top-left corner and I can't see anything. However, when I resize the screen, it suddenly displays perfect ...

Comparing prevProps and this.props in React Native Redux: What is the most effective method?

Does anyone know how to efficiently handle triggering a function in my React Native app only when a specific prop has changed? This is the current implementation I have: componentDidUpdate(prevProps) { if (prevProps.a !== this.props.a) { <trigger ...

Pinterest's "Pin it" button causing issues with the 'back' function in Internet Explorer

Recently, I discovered a problem with the "Pin it" button for Pinterest in Internet Explorer (v9 at least). It seems that this button is causing issues with the 'back' functionality in the browser. When right-clicking on it, an entry like '& ...

Guide on retrieving the response headers with jQuery and AJAX

Connection: keep-alive Content-Length: 2231 Content-Type: text/html; charset=utf-8 Date: Thu, 13 Sep 2018 07:37:46 GMT ETag: W/"8b7-XOXhf04O/VM7yxWQ561PEgxRfz8" x-auth: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1YjlhMGEyM2Q0NmI3YjFmYTQzNWI ...

Transmitting a multidimensional array in JavaScript to an AjaxPro method on a front-end webpage: A step-by-step guide

Imagine a scenario where I have a C# method that requires an array parameter: [AjaxPro.AjaxMethod] public int Test3(string[,] array) { return array.Length; } Next, I define a multidimensional array on the front page using JavaScript: var array = ...

Dealing with Buffer data received from a NextJS backend API

In my NextJS application, one of the backend API routes returns a JSON object that includes a buffer. // The nodeConfiguration contains a buffer for the nodeId property res.status(200).json(nodeConfiguration); However, when trying to display the nodeId va ...

What is the best way to send variables from JavaScript to PHP while utilizing Ajax technology?

While I have noticed similar questions like this one before, I want to address my specific concerns. In previous examples, the questioner referred to using Ajax in a format similar to this: $.ajax({ type: "POST", url: 'logtime.php', ...

The term "Cardlist" has not been defined and is therefore causing an

I created a CardList and attempted to add cards into the list using map, but encountered an error import React from 'react'; import Card from './Card'; const CardsContainer = ({robots}) => { const cardComponents = robots.map((r ...

The detected coordinates are offset from the location of the mouse click

Seeking guidance: I need advice on an issue that arises when clicking on the second tooth from right to left, causing the upper teeth to be colored instead: https://i.sstatic.net/czzmc.png Below is a step-by-step explanation of what the code does: 1) T ...

"Searching for existing data in MongoDB upon click event from the client side: A step-by-step guide

I have developed an express app that allows users to search for movies and add them to lists. If a movie is already added to the list, I want to show 'Already added' instead of 'Added to list'. How can I achieve this functionality from ...

AngularJS date and time picker featuring user-defined input validation

Is there an AngularJS component available that offers both a date/time picker and the ability to input dates using the keyboard? ...