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

DataSource schema model field - from property

1 Answer 129 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Iulian
Top achievements
Rank 1
Iulian asked on 19 Feb 2014, 10:38 PM
Hello,

I have a simple datasource with the following schema:
schema: {
                data: "Items",
                total: "Count",
                model: {
                    Id: { type: "number" },
                    Name: { type: "string" },
                }
            }


I use the datasource for a dropdown.
When i select a value and programatically check the $("#CountyId").data('kendoDropDownList').value() I get the correct id (an int value)

Because I use the dropdown in a cascading scenario i need to transform the Id field on the model in a CountyId.
So after reading the documentation i decided to transform my schema into:

schema: {
                data: "Items",
                total: "Count",
                model: {
                    CountyId: { type: "number", from: 'Id' },
                    Name: { type: "string" },
                }
            }


Yet, now when I check the selected value: $("#CountyId").data('kendoDropDownList').value() I get an [object Object]

Please tell me what I am doing wrong.

Thank you


1 Answer, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 24 Feb 2014, 08:10 AM
Hi Iulian,

This behavior is expected with the current configuration, as the field's options should be specified within the schema.model.fields object. For example: 
schema: {
    data: "Items",
    total: "Count",
    model: {
        fields: {
            CountyId: { type: "number", from: 'Id' },
            Name: { type: "string" }
        }
         
    }
}


Regards,
Alexander Popov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
General Discussions
Asked by
Iulian
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or