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

How to use guid as the id for kendo datasource

1 Answer 319 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
pedro
Top achievements
Rank 1
pedro asked on 07 Feb 2013, 12:52 PM
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

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 11 Feb 2013, 09:02 AM
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!
Tags
Data Source
Asked by
pedro
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or