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

Group Data returned by WebAPI JSON

2 Answers 104 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 2
Markus asked on 05 Dec 2013, 03:53 PM
The commented part of the code does work, but when I try to group my own stuff it fails.

http://mobile.zuol.ch/api/t_links/getLinks

Is my group: simply at the wrong place or what am I doing wrong?

Markus

var dataSource = new kendo.data.DataSource({
    type: "json",
    transport: {
        read: {
            url: "http://mobile.zuol.ch/api/T_links/GetLinks",
            data:{
                Accept: "application/json"
            },
            group:{
                field: "Kategorie"
            }
        }
    }
     
     
        
      /*     data: [
      { name: "Sashimi Salad", description: "Organic greens topped with market fresh sashimi, wasabi soy vinaigrette.",  letter: "S" },
      { name: "Seaweed Salad", description: "A nice seaweed salad.",  letter: "S" },
      { name: "Edamame", description: "Boiled soy beans with salt.",  letter: "E" },
      { name: "Maguro", description: "Tuna pieces.",  letter: "M" },
      { name: "Tekka Maki", description: "Tuna roll with wasabi.",  letter: "T" },
      { name: "California Rolls", description: "Crab sticks, avocado and cucumber.",  letter: "C" }
    ],
    group: { field: "letter" } */
});
 
function LinksListviewInit() {
    $("#filterable-links").kendoMobileListView({
        dataSource:  dataSource,
        template: $("#links-template").text(),
        headerTemplate: $("#links-header-template").text(),
        filterable: {
            field: "Kategorie",
            operator: "startswith",
            placeholder: "Tippen Sie hier um zu filtern ..."
        },
      
    });
}

2 Answers, 1 is accepted

Sort by
0
Markus
Top achievements
Rank 2
answered on 05 Dec 2013, 03:59 PM
The above commented code works perfect. The uncommented returns data but no group headers.

-----------------------------------

I also tryed this approach

this will return an error. 

Uncaught TypeError: Object [object Object] has no method 'slice' (Icenium)

var dataSource = new kendo.data.DataSource({
    type: "json",
    transport: {
        read: {
            url: "http://mobile.zuol.ch/api/T_links/GetLinks",
            data:{
                Accept: "application/json"
            },
           
        }
    }
     
     
 
});
 
function LinksListviewInit() {
    $("#filterable-links").kendoMobileListView({
 dataSource: kendo.data.DataSource.create({data: dataSource, group: "Kategorie"}),
        template: $("#links-template").text(),
        headerTemplate: $("#links-header-template").text(),
        filterable: {
            field: "Kategorie",
            operator: "startswith",
            placeholder: "Tippen Sie hier um zu filtern ..."
        },
      
    });
}
0
Alexander Valchev
Telerik team
answered on 09 Dec 2013, 01:19 PM
Hi Markus,

Your first attempt does not work because group configuration is not defined in the right place. Second code snippet is not working because `dataSource` is a DataSource instance which cannot be assigned to the data attribute. Please try the following:
var dataSource = new kendo.data.DataSource({
    transport: {
        read: {
            url: "http://mobile.zuol.ch/api/T_links/GetLinks",
            data:{
                Accept: "application/json"
            }
        }
    },
    group: {
        field: "Kategorie"
    }
});


Regards,
Alexander Valchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Data Source
Asked by
Markus
Top achievements
Rank 2
Answers by
Markus
Top achievements
Rank 2
Alexander Valchev
Telerik team
Share this question
or