How to use guid as the id for kendo datasource

2 posts, 0 answers
  1. pedro
    pedro avatar
    4 posts
    Member since:
    May 2009

    Posted 07 Feb 2013 Link to this post

    This code fails if the Guid is in uppercase:

     datasource.bind("change", function (e)
        {
            var element = datasource.get('90a11073-cbfe-4442-9330-9b94d83d53a2')
            ok(element);
            start();
        });

    How can I make the id in the schema case insenstive?

    Thanks,
    Pedro
  2. Daniel
    Admin
    Daniel avatar
    2230 posts

    Posted 11 Feb 2013 Link to this post

    Hello Pedro,

    The get method compares the passed value directly and does not support using a case-insensitive search. You could implement this with a custom function which converts the id and the value to lower case:

    datasource.bind("change", function (e)
    {
        var element = myGet(this.data(),'90a11073-cbfe-4442-9330-9b94d83d53a2');
        ok(element);
        start();
    });
     
    function myGet(data, value) {
        var lower = value.toLowerCase();
        for (var i = 0; i < data.length; i++) {
            if (data[i].id.toLowerCase() == lower) {             
                return data[i];
            }
        }
    }
    Regards,
    Daniel
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top