This is a migrated thread and some comments may be shown as answers.

XML Binded Datasource with empty data doesn't work in Grid

8 Answers 604 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ingolf
Top achievements
Rank 1
Ingolf asked on 10 Jan 2012, 10:04 AM
Hi,

i have an virtual binded xml datasource in a grid. All works fine, but when the server has no records the browser has errors in Javascript because undefined values are in XML Data.

Sample:
<count>1</count><books><book><field1>Hallo</field1></book></books>  -> This works fine

But if there are no books the browser reported errors:
<count>0</count><books></books>  

Browser message:Uncaught TypeError: Cannot read property 'field1' of undefined

8 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 10 Jan 2012, 12:45 PM
Hi Ingolf,

I was able to observed the error you have described and we were able to address it. Therefore, I have attached an internal build which contains the fix. I have also updated your telerik points.

Regards,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ingolf
Top achievements
Rank 1
answered on 10 Jan 2012, 04:47 PM
Hi,

thank you for your fast help.

You have attached OpenSource Files. I use the commercial version. Is this the same? When not can you send me the commercial version Files.

regards
Ingolf
0
Rosen
Telerik team
answered on 11 Jan 2012, 08:55 AM
Hi,

Indeed, the files in both open source and commercial version are same.

Greetings,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
S
Top achievements
Rank 1
answered on 17 Feb 2012, 02:46 PM
Is there an updated version of the (code above - of xml grid example) for latest version of Kendo UI? This version doesnt work when latest kendo javascript files are embedded and newer version of jquery. I just get following error,

Object doesn't support this action


            that.reader = new kendo.data.readers[options.schema.type || "json" ](options.schema);



0
Rosen
Telerik team
answered on 20 Feb 2012, 08:23 AM
Hi,

Could you please verify that you have included the kendo.data.xml file and all of the other dependencies are included correctly.

Regards,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Roger
Top achievements
Rank 1
answered on 03 May 2012, 08:45 PM
0
Adrian
Top achievements
Rank 1
answered on 31 May 2012, 10:04 PM
I believe the error that people are still seeing, as well as me, has to do with an empty grid and the grid columns footerTemplate attribute with aggregate data functions (i.e. sum).  If I remove columns from the grid that contain aggregate data in the footerTemplate, the error goes away.
Error messages I receive:
  • Uncaught TypeError: undefined has no properties
  • Uncaught TypeError: Cannot read property 'sum' of undefined
In addition to this issue, is there a way to have a default display (i.e. "No records found") for an empty grid?

0
Adrian
Top achievements
Rank 1
answered on 31 May 2012, 10:52 PM
I figured out a way around this error.  It involves doing a fetch on the the dataSource then checking the size (length) of the view:
var ds = new kendo.data.DataSource({ ... });
ds.fetch(function () {
    var dv = this.view();
    if (dv.length > 0) {
        var grid = $("#grid").kendoGrid({ ... }).data("kendoGrid");
    } else {
        alert("No records found");
    }
});
Tags
Grid
Asked by
Ingolf
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Ingolf
Top achievements
Rank 1
S
Top achievements
Rank 1
Roger
Top achievements
Rank 1
Adrian
Top achievements
Rank 1
Share this question
or