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

Errors in grid sorting and grouping with XML data source

7 Answers 221 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris Rogers
Top achievements
Rank 1
Chris Rogers asked on 11 Dec 2011, 03:34 AM

I've reproduced a problem I'm seeing in my own application by modifying the Data Source > Binding to XML example to use a grid for rendering rather than a template, as shown in the code below.   Except for specifying an original sort order, the data source is unchanged.  I've configured the grid to allow grouping and sorting.  However, whenever I attempt to either group or sort, I get

    Error: Unable to get value of the property 'book': object is null or undefined

The debugger call stack indicates that the error is occurring in an "evaluate" method in kendo.data.xml.min.js.  (I have the trial version, so can't inspect the source code further.)

Additionally, my original sort order is not being respected;  the grid loads unsorted.

Are these bugs mine or the framework's?

<div id="grid"></div>
 
<script>
    $(document).ready(function() {
        var element = $("#grid").kendoGrid({
            dataSource: {
                transport: {
                    read: "books.xml"
                },
                schema: {
                    type: "xml",
                    data: "/books/book",
                    model: {
                        fields: {
                            title: "title/text()",
                            author: "author/text()",
                            url: "url/text()",
                            cover: "@cover"
                        }
                    },
                sort: { field: "title", dir: "asc" }
                }
            },
            columns: [ "title", "author", "url" ],
            groupable: true,
            sortable: {
                mode: "single",
                allowUnsort: false
                }
        });
    });
</script>

7 Answers, 1 is accepted

Sort by
0
Chris Rogers
Top achievements
Rank 1
answered on 11 Dec 2011, 03:54 AM
I just noticed that paging suffers from the same problem.
0
Accepted
Rosen
Telerik team
answered on 12 Dec 2011, 03:01 PM
Hello Chris Rogers,

I have looked at the code you have pasted, it seems that you have set the sort expression as property of the schema, instead of the dataSource. Please correct this and see if there is a change in the behavior you have described.

Regarding the error you have described, I suspect it is caused by an issue which we have already addressed and the fix will be available with the next official release. Meanwhile, I have attached a internal build for you to test.

All the best,
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
Chris Rogers
Top achievements
Rank 1
answered on 12 Dec 2011, 03:18 PM
Thanks, Rosen!  You are right -- I had that sort property in the wrong place.  Moving it to the right place caused the original sort to work, though subsequent sorting and grouping were still broken.  However, your new build fixed those bigger problems!  Thanks so much!
0
Etienne
Top achievements
Rank 1
answered on 08 Jan 2012, 08:38 PM
Hello Rosen,

If had the same problem with sorting, and have used the fix you attached.
There is still an other problem:
The dropdown items of the filter are empty when using XML data as source.

Regards,

Etienne
0
Rosen
Telerik team
answered on 09 Jan 2012, 01:10 PM
Hi Etienne,

This is known issue which has been already addressed. The fix will be included in the next service pack of the library.

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
wizmagister
Top achievements
Rank 2
answered on 20 Jan 2012, 09:21 PM
Hello, just to make sure. Still have the problem and using version from january 11: look at these sorts results, look like the last one gets ignored. 

0
Rosen
Telerik team
answered on 23 Jan 2012, 04:01 PM
Hi Marc,

Unfortunately, I'm unable to recreate the described issue locally. Thus, it will be appreciated if you could provide a small sample in which it can be observed.

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!
Tags
Grid
Asked by
Chris Rogers
Top achievements
Rank 1
Answers by
Chris Rogers
Top achievements
Rank 1
Rosen
Telerik team
Etienne
Top achievements
Rank 1
wizmagister
Top achievements
Rank 2
Share this question
or