Pending Review
Last Updated: 23 Aug 2017 10:00 by Telerik Admin
Stacey
Created on: 10 Aug 2013 20:28
Category: MVVM
Type: Feature Request
76
.Where, .Select, .Single, .OrderBy, First on ObservableArray
It would be exponentially helpful if the "ObservableArray" implemented some basic "Where/Select/Single" methods. This would assist in searching through them and give Kendo UI a much needed facelift in the array department.

Behavior would be, theoretically, as follows...

var viewModel = kendo.observable({
    Users: [
    {
       id: 1,
       name: "Stacey"
     },
     {
       id: 2,
       name: "Dylan"
     },
     {
       id: 3,
       name: "John"
     }
 ]
});

var idSearch = 1;

var result = kendo.Search(viewModelArray).Where(function(x) { return x.id == idSearch });

or ...

var result = kendo.Search(viewModelArray)
.Single(function(x) { return x.id == idSearch });

or possibly even chained like in "linqjs"

var result = kendo.Search(viewModelArray)
.Where(function(x) { return x.id == idSearch })
.Single();

5 comments
Imported User
Posted on: 23 Aug 2017 10:00
No to this. Just use lodash.
Imported User
Posted on: 26 Nov 2014 10:53
I think kendo should focus on getting a few more core problems fixed and let the likes of jslinq worry about this type of problem.
Benjamin
Posted on: 16 Jan 2014 10:09
I also use JSLINQ. You got all what you need in this library and even more
Jason
Posted on: 17 Nov 2013 20:15
why would you just use lodash, or underscore for this? Those libraries are already mature and super optimized (ok mostly just lodash)
Stacey
Posted on: 21 Sep 2013 18:33
I am currently working on this with JSLINQ, which you can see at jslinq.codeplex.com - it is a VERY thin library (only 187 lines!) and can be easily adopted to fit with Kendo's ObservableArray model.