Retrieving a string during an update request within the KendoUI datasource

I am facing an issue with my grid and data source setup. The schema.parse function is causing some unexpected behavior.

Whenever I try to update or create a new row, the schema.parse() function is called again. The parameter passed to it is a string containing the HTML of my page, which is confusing me. Any insights on what might be causing this?

  var _dataSource = new kendo.data.DataSource({
        transport: {
            read: {
                dataType: "json",
                url: layerDefProvider.getLayerUrlById("surveys") + "/query",
                data: {
                    f: "json",
                    where: "1=1"
                },
                type: "POST"
            },
            create: function (options) {
                console.debug("called");//never gets called
            },
            update: function (options) {
                console.debug("called");//never gets called
            },
            destroy: function (options) {
                console.debug("called");//never gets called
            }

        },
        filter: {
            field: "OBJECTID", operator: "eq", value: 0
        },
        schema: {
            data:function(response) {

            },

            parse: function (data) {//on loading it is fine, on updating the data param is a string of my HTML of the page
                var rows = [];
                var features = data.features;
                if (!features) {
                    return [];
                }
                for (var i = 0; i < features.length; i++) {
                    var dataRow = {};
                    dataRow.OBJECTID = features[i].attributes.OBJECTID;
                    dataRow.Name = features[i].attributes.Name;
                    dataRow.Date = features[i].attributes.Date;
                    dataRow.Comment = features[i].attributes.Comment;
                    rows.push(dataRow);
                }
                return rows;
            },
            model: {
                id: "OBJECTID",
                fields: {
                    OBJECTID: { type: "number", editable: false },
                    Name: { type: "string" },
                    Date: { type: "string" },
                    Comment: { type: "string" }
                }
            }
        }
    });

    var _surveysPicker = $(config.table).kendoGrid({
        toolbar: ["create","save"],
        editable: true,
        dataSource: _dataSource,
        height: 300,
        sortable: true,
        selectable: "multiple",
        columnMenu: true,
        resizable: true,
        columns: [{
            field: "OBJECTID",

            width: 40
        }, {
            field: "Name",

            width: 40
        }, {
            field: "Date",

            width: 40
        }, {
            field: "Comment",

            width: 100
        }]
    });

Answer №1

For parsing data during a read action, ensure your parse function is located within the read event.

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

Modify the height of an element in real-time using jQuery

I'm looking to dynamically adjust the height of a div based on another element, but only if that element does not have the class collapsed (which is used in a Bootstrap toggle collapse feature). The initial setup seems to work fine, however, when I i ...

The integration of Material-UI Autocomplete and TextField causes google autocomplete to activate

I am currently working on integrating the Autocomplete component into my project. However, I am facing an issue where the browser's autofill/autocomplete feature kicks in after some time. Is there a way to disable this behavior? ...

React unable to properly render Array Map method

I am currently working on a project using ChakraUI and React to display a list of team members as cards. However, I am facing an issue where only the text "Team Members" is being displayed on the website, and not the actual mapped array of team members. Ca ...

"Invalid: string path required" (version 5.10.0)

There's this file (a large bundle of a couple of JS files) that used to work perfectly with browserify (version 5.10.0) until just recently, but now it's not cooperating. Here's the command I'm using: $ browserify index.js -o dist/out ...

User-triggered event not being emitted back from SocketIO server

In my React frontend, I am using socket.io-client and in the Express backend application, I am utilizing socket.io. There is an event on the server that sends a message to all users in a room when triggered. socket.on('connection', () => { ...

Issue: $injector:unpr Unknown Provider (app.js is appearing to be properly defined)

Struggling with the unknown provider issue, I've searched through other threads and tried their solutions to no avail. My goal is to inject 'MockSvc' service into a controller without encountering any errors. Any advice would be greatly appr ...

Improved efficiency in CSS for left transition animations

Here is the current code I am using: .s2 { top: 150px; left: 20px; position: absolute; transition: left 300ms linear; } I am currently updating the left position dynamically using JavaScript based on scroll events. However, I have noticed that th ...

Tips for securely concealing an API key during website deployment on Netlify

Recently, I created a small website using Javascript just for fun and I'm looking to deploy it to Netlify. However, I've encountered an issue with the API key that the website uses. I'm struggling to figure out how to conceal this key. Curre ...

What is the best practice for adding a DOM element at a precise location within an ng-repeat loop?

I am currently working on developing a podcast player application using AngularJS. At this point, I have successfully created a list of available podcasts that can be played, utilizing ng-repeat. The code for the list is shown below: <ul ng-controller ...

Avoid showing images when the link is not working

I am dynamically fetching images and displaying them on my webpage. return <div className="overflow-hidden "> <Image className="relative w-full h-40 object-cover rounded-t-md" src={cover_url} alt={data.name} ...

"Enhance user experience with AJAX for selecting multiple checkboxes or performing mult

Hey there! So, I've got a question about handling multiple checkboxes with the same name in a form. Here's an example of what I'm working with: <input type="checkbox" name="myname[]" value="1" /> <input type="checkbox" name="myname ...

Verify if the text field is currently blank or has content before applying attributes

How can I disable one text box if another specific text box is filled within a div containing multiple text boxes? For example: When I enter text in textbox(4), I want to automatically disable textbox(1). And if I remove the text from textbox(4), I want t ...

Attach an event listener to the HTML content

Being new to Javascript, I am attempting to add an event listener for each button on every card. However, the code seems to only apply the event 'click' to the last card (button). Is there a way to make this work with the innerHTML of the card? l ...

jQuery eliminates initial div just a single time

Here is a function I have created: function removeDiv() { var topmost = jQuery('.xx'); var totContent = topmost.find('.zz').length; var $target = jQuery('.xx').find('.zz').eq(0); if(totCont ...

After consolidating buffer geometries, adjusting the transparency/opacity of the shapes is not an option for me

I've been working on a model with multiple boxes and trying to optimize draw calls by using buffer geometry merger. However, I'm facing an issue where I can't change the opacity of geometries after merging. Here are the things I've tri ...

The Vue.js modal is unable to resize below the width of its containing element

My challenge is to implement the Vue.js modal example in a larger size. I adjusted the "modal-container" class to be 500px wide, with 30px padding and a max-width of 80%. However, I'm facing an issue where the "modal-mask" class, containing the contai ...

Guide to cycling through Promise results and populating a form

I have an asynchronous function that returns a Fetch Request: async fetchDataByCodOS(codOS){ const res = await fetch( 'http://localhost:5000/cods/'+codOS, { method:"GET" } ).then(res => ...

Activate the submission button only when all the necessary fields have been completed

I am currently working on a form that consists of 3 fields: email_from, email_subject, and an editor. The editor is built using draftjs. I am facing an issue with enabling the submit button only when all the fields are filled without any errors. Below is ...

Modify the JSON structure of a deeply nested object

I am attempting to convert a deeply nested JSON object from one structure to another so that it can be properly used with the jQuery Nestable library. Here is the original format I am working with: { "scanned": { "a3": { ...

There are multiple sets of radio buttons within nested ng-repeats, but only the final group displays the selected value

I am having an issue with updating a form that contains multiple radio buttons based on data retrieved from an API. The challenge is that only the last set of radio buttons displays the value correctly. Below is the code snippet I am using (angular bracket ...