Need More Info
Last Updated: 12 Dec 2022 10:32 by ADMIN
Paul
Created on: 28 Nov 2022 19:07
Category: Kendo UI for jQuery
Type: Bug Report
0
Kendo DataSource prefilled on page sometimes does not load

I have a number of DataSource items in the event editor template. They are small JSON objects and it would be dumb to read them from the server each time. They do not change and are part of the page load. You can see here I am just serializing them into the page itself:

  

This works 9 out of 10 times. But sometimes the dataset is empty. Which is crazy because I am always filling it. I managed to find a work around on the event edit event that gets called but this seems strange to do. Not sure if there is a true bug here or not. Feels like it because this code should not have been needed:

3 comments
ADMIN
Neli
Posted on: 12 Dec 2022 10:32

Hello Paul,

The returned result is different before and after using the data() method, as initially the data has not been retrieved. Thus, you will need to either use the read method to reads data items or another option is to use fetch:

https://docs.telerik.com/kendo-ui/api/javascript/data/datasource/methods/fetch

Let me know in case you have additional questions.

Regards,
Neli
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Paul
Posted on: 05 Dec 2022 19:37

Oddly I can reproduce this every time now. The kendo.data.DataSource never seems to be initialized. In fact, I can reproduce this without a web site just using the browser F12 window console. In this case I limited my objects to 2 objects for shortened code. It was an intermittant thing. Had this been always the case I would not have opened a bug request for it.

Now it happens 100% of the time with just the code below. You can see the read() method is required. Is this my misunderstanding?

Here's the console.

If it helps, here is what was pasted:

 

var foo = new kendo.data.DataSource({
   data: [{"Id":10,"Abbreviation":"AR","ColorHtml":"#DCA5C9","TextColorHtml":"Black","Description":"Assignment Review"},{"Id":4,"Abbreviation":"EA","ColorHtml":"#FF0000","TextColorHtml":"White","Description":"Estimate Appointment"}]
});

// returns 0
foo.data().length;

foo.read();

// returns 2

foo.data().length;


ADMIN
Martin
Posted on: 05 Dec 2022 13:09

Hello, Paul,

Could you please provide a runnable project where we can observe the issue and do some debugging? We will then be able to decide whether a bug should be logged or not.

Thank you for the cooperation in advance. Looking forward to your reply.

Regards,
Martin
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.