Issues with Kendo Grid showing incomplete data and columns

Having trouble populating a kendo grid with column titles, as some columns appear empty despite having data when checked in the console log.

$(function () {
  $("#uploadBtn").click(function () {
    var url = window.rootUrl + 'Upload/UploadM';
    var fileUpload = $("#fileID").get(0);
    var files = fileUpload.files;
    var data = new FormData();
    data.append(files[0].name, files[0]);

    $.ajax({
      url: url,
      type: "POST",
      contentType: false, // Not to set any content header
      processData: false, // Not to process data
      data: data
    }).done(function (res) {
      console.log("dataTable", res)
      $('#AttachGrid').empty();
      $("#AttachGrid").kendoGrid({
        columns: [
          { field: "DATA_CATEGORY_QOS_CODE", title: "QOS" },
          { field: "DOWNLOAD_SPEED_CLASS_CODE", title: "download" },
          { field: "OPERATOR_OBJECTID", title: "operator" },
          { field: "SETTLEMENT_CODE", title: "settlement" },
          { field: "SHAPE", title: "shape" },
          { field: "TECHNOLOGY_CODE", title: "tech" },
          { field: "UPLOAD_SPEED_CLASS_CODE", title: "upload" },
          { field: "Message", title: "message" }
        ],
        dataSource: res.Data
      });
    })
  });
});

This is how the table appears using this code:

The data seems to be present, but it's not displaying correctly in the kendo grid. However, if I remove the columns property, the entire dataset loads correctly.

$.ajax({
      url: url,
      type: "POST",
      contentType: false, // Not to set any content header
      processData: false, // Not to process data
      data: data
    }).done(function (res) {
      console.log("dataTable", res)
      $('#AttachGrid').empty();
      $("#AttachGrid").kendoGrid({
        
        dataSource: res.Data
      });
    })

Unable to customize column titles in this way. Any idea what could be causing the issue?

Answer №1

Clearly stated..... The property names in your JSON Data do not align with the column fields.

The JSON is labeled as DATA_CATEGORY_QOS_OBJECTID while the field is listed as DATA_CATEGORY_QOS_CODE, causing Kendo UI to not match correctly........

Similar issue persists with other properties/fields~

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 reason for jQuery displaying undefined when attempting to retrieve a custom data attribute using .prop()?

In my dynamic HTML generated by JavaScript, the following code snippet is included: $(".task-status").live("click", function () { alert("data-id using prop: " + $(this).prop("data-id")) alert("data-id using data: " + $(this).data("id")) ...

Building a React Redux project template using Visual Studio 2019 and tackling some JavaScript challenges

Seeking clarification on a JavaScript + TypeScript code snippet from the React Redux Visual Studio template. The specific class requiring explanation can be found here: https://github.com/dotnet/aspnetcore/blob/master/src/ProjectTemplates/Web.Spa.ProjectT ...

How to eliminate periods (.) from key strings in JSON data before inserting into MongoDB collections

When trying to insert Json into MongoDB using the C# Driver, I encountered an exception because inserting JSON with keys that contain dots (.) is not allowed. Now, I am looking for a way to replace all dots in keys with underscores (_) or something else... ...

What is the best way to set an object's value to null in AngularJS?

Check out this code snippet var data={}; data={stdId:"101"}; data={empId:"102"}; data={deptId:"201"}; In my project, I'm receiving data from services into a data object with differing key names such as stdId or empId, etc. I need to set empty val ...

Clicking a button opens a new window, except when using the .onclick() method

My current situation involves using software that generates all the HTML/XML code for me, so I don't have direct access to it. I've created a button that is intended to open a form in a new window. Strangely, when I physically click on the button ...

Unable to add chosen elements to array - Angular material mat select allowing multiple selections

Can anyone assist me in figuring out what I am doing wrong when attempting to push data to an empty array? I am trying to only add selected values (i.e. those with checked as true), but I can't seem to get inside the loop This is the current conditi ...

Obtain the index of the selected item from a dropdown menu

Is there a way for the selectedIndex to return -1 if no item is selected, instead of the element's text at position 0? It seems that the selectedIndex always returns 0 even when nothing is selected. <select id="abc" name="abc"> <option& ...

Webpack has successfully built the production version of your ReactJS application. Upon review, it appears that a minified version of the development build of React is being used

Currently, I am implementing Reactjs in an application and the time has come to prepare it for production. In my package.json file, you can see that there is a "pack:prod" command which utilizes webpack along with a specific webpack.config.js file to build ...

What could be causing the issue with the variable appearing as undefined in

My class has a property: public requestLoadPersonal: Personal[] = []; As well as a method: private filterByGender(selectedValue: any): void { console.log(this.requestLoadPersonal); this.requestLoadPersonal = this.requestLoadPersonal.filter( ...

"Custom object fails to deserialize properly using Json.NET, resulting in a null value

I'm struggling with converting a JSON string to a C# object using Json.NET. I utilized the AJAX call .ashx $.ajax({ url: "/Handler/Handler.ashx?WorkType=SaveData", type: "POST", data: JSON.stringify({ 'DataInfo': Info }), / ...

Unpredictable algorithm for selecting the champion

I manage a website that features promotions and users. Users have the ability to register for these promotions, with one random user selected as the winner. Initially, the formula for selecting the winner was quite simple: $total_users = 100; //total use ...

How to use the Enter key to submit a form in react.js with the help of "@material-ui/core/Button"

Here is the form I have created using the render method for user sign-in. <form onSubmit={this.handleSubmit}> <Avatar className={classes.avatar}> <LockOutlinedIcon /> </Avatar> <Typography component="h1" varia ...

How require works in Node.js

My current database connection module looks like this: var mongodb = require("mongodb"); var client = mongodb.MongoClient; client.connect('mongodb://host:port/dbname', { auto_reconnect: true }, function(err, db) { if (err) { ...

Leveraging jquery's $.ajax method to send GET values to a PHP endpoint

Is it possible to use an AJAX call to pass a value to a PHP script? For example, if I have the URL example.com/test.php?command=apple, how can I make sure that the code is executed properly on the server side? This is how my code looks like: PHP: <?p ...

By harnessing a JSON response

After sending an ajax request, the server's response is as follows: {"error":false,"success":true} The ajax code used: $.ajax({ url: '/update', type: 'post', data: $(this).serialize(), success: function(response) ...

How can I extract the id of a clicked item and pass it to a different page with Jquery?

Facing an issue where the attribute value of a clicked href tag is not retained after browser redirection. Initially, when clicking on the href tag, the value is displayed correctly. However, upon being redirected to the peoplegallery_album, the id becomes ...

Approximately 20% of spoken words are not accurately conveyed by Speech Synthesis Google Voices, failing to adhere to the intended voice selection

When using speechSynthesis.speak(utterance) in Chrome with the "Google UK English Female" voice, there is an issue where a male voice is randomly spoken instead. Any thoughts on how to resolve this? Latest Update: July 26th, 2022 This appears to be a bug ...

What is the best way to transfer an object property to an event handler function for executing DOM manipulation tasks?

I am working on a React-rendered HTML page that displays a list of objects representing websites. I have successfully stored these objects in memory and can show them in a long list on the page without any issues. Recently, I added a button for each objec ...

Refreshing and reloading within the same jQuery function

My PHP application involves the use of 2 PHP files. chart.php - This page includes a Google chart. <div id="chart_div" style="height:100%;width:100%"> </div> <script type="text/javascript"> google.charts.load('current', ...

there is no httpPost run method available

I'm experiencing an issue with my MVC application where the browser is unable to send POST data to the controller method. When testing with the "GET" parameter, the parameter is successfully passed. However, when using "POST", nothing happens and it&a ...