binding to GUID on DataValue field

2 posts, 1 answers
  1. newKendoUser
    newKendoUser avatar
    10 posts
    Member since:
    Oct 2017

    Posted 31 Jan 2018 Link to this post



    I have a Kendo Drop down, displaying remote data (of type odata) implemented as follows:


            filter: "contains",
            dataTextField: "displayName",
            dataValueField: "fieldid",
            optionLabel: "Please Select..."
            dataSource: {
                type: "odata-v4",
                transport: {
                    read: function (options) {
                            url: someURL,
                            dataType: "json",
                            success: function (result) {
                            error: function (result) {

    the 'fieldId' in this case is of type GUID. The drop down is created successfully and displaying data on screen. Using the no data template i can also successfully add a new item and refresh the drop down to the item is available on the list. 


    I would like to dynamically set the selecteditem on the drop to the item that has just been added. I am using the following code. 




    'newfieldId' is a GUID that has been returned by the ajax call which has just created the new item. This is getting a value successfully, however doesnt appear to work. I have also tried hard coding this to use a value which i know existsin the drop down which i pass in as a string as i would expect a GUID to and this still doesnt work. This leads me to believe i havent configured my drop down correctly for using the GUID as the datavalue field. 


    Can you confirm if this is the case?


    Many thanks

  2. Answer
    Neli avatar
    221 posts

    Posted 02 Feb 2018 Link to this post

    Hi Martina,

    In order to set the selected item in the DropDownList you can use the select() method.
    As you can see in the 'Add New Item' demo, this method is used, so after a new item is added to the DropDownList, it is also set as a currently selected item"sync", function() { - 1);

    You should be able to select the item with the value() method as well. Enclosed you will find an example where the item is selected by using the value method:"sync", function(e) {                 
    var lastIndex = - 1;
    var last =[lastIndex];

    Could you please let us know if you are using the same approach as in the provided example? May I ask you to modify the example in order to replicate the issue the way it is at your end?This will help us to inspect it locally and provide further assistance.

    I hope this information helps.

    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top