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

Manipulating dataSource with nested templates

3 Answers 78 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 16 Nov 2015, 04:28 PM

Hi, I've recently started working with Kendo UI. I have been reading this forum to find answers usually very good. However I am struggling to replicate inline json data in to remote one. Please see below. This works fine creating me the Title for the radio group just as expected however the minute I try using the remote JSON.

http://jsbin.com/sanixi/edit?html,js,output

This is the code should be replacing " var tileDataSource " array with it's remote counterpart below:

 var tileBaseUrl = "//localhost:8000/data/repTiles.json";
    var tileDataSource = new kendo.data.DataSource({
        transport: {
              read: {
                  url: tileBaseUrl,
                  contentType: "application/json; charset=utf-8",
                  dataType: "json"
              },
              update: {
                  url: tileBaseUrl,
                  dataType: "json"
              },
               create: {
                  url: tileBaseUrl,
                  dataType: "json"
              },
              destroy: {
                  url: tileBaseUrl,
                  dataType: "json"
              },
              parameterMap: function(obj, operation) {
                  if (operation !== "read" && obj.models) {
                      return {
                          models: kendo.stringify(obj.models)
                      }
                  }
                  return obj;
              }
          }
   });

What am I missing here? what am I doing wrong? trying to achieve an all remote JSON code here. I have used this code for to remote load JSON for kendoComboBox and kendoDropDownList etc. All worked fine.

Please have a look any ideas how I can achieve this.

Thanks.

 

3 Answers, 1 is accepted

Sort by
0
James
Top achievements
Rank 1
answered on 16 Nov 2015, 04:53 PM
0
Accepted
Daniel
Telerik team
answered on 18 Nov 2015, 01:17 PM
Hello,

I am not sure if I understand correctly what you mean by replace, but if "tileDataSource" is a dataSource then the Categories dataSource should no longer be needed(updated example). Also, the latest versions support source binding to dataSource so the change handler should also not be needed.

Regards,
Daniel
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
James
Top achievements
Rank 1
answered on 19 Nov 2015, 04:21 PM

Thanks Daniel. I am creating nested templates and loading different input types, I managed radio group and check box types so far, no sure yet this type of template support combobox and rage sliders.

In my trial and error  approch I could not get it to load the JSON remotely. I guess " tileDataSource.read() " was missing.

That works perfect now.

Tags
Data Source
Asked by
James
Top achievements
Rank 1
Answers by
James
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or