最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to check if a kendo grid contains specific item with javascript - Stack Overflow

programmeradmin2浏览0评论

I have an ASP.NET MVC project. In one view there is a Kendo Grid named FullNameList and there is only one column named FullName, there is bunch of data inside the grid; all of them are simple string names. I want to know if there is a method to check whether the kendo grid contains an specific item or not? If not how can I iterate through datasource items to check one by one the items?

I have an ASP.NET MVC project. In one view there is a Kendo Grid named FullNameList and there is only one column named FullName, there is bunch of data inside the grid; all of them are simple string names. I want to know if there is a method to check whether the kendo grid contains an specific item or not? If not how can I iterate through datasource items to check one by one the items?

Share Improve this question edited Jan 10, 2020 at 15:52 Richard 27.5k4 gold badges28 silver badges43 bronze badges asked Aug 12, 2018 at 7:31 yekanchiyekanchi 8531 gold badge12 silver badges33 bronze badges 1
  • i must add that i have read bunch of questions related to kendo grid to find the answer with similar or a little different question but i couldn't figure it out. – yekanchi Commented Aug 12, 2018 at 7:33
Add a ment  | 

1 Answer 1

Reset to default 9

In the client (i.e. browser) the data source data can be searched using javascript Array some method:

var searchName = "Yekanchi";

var searchNameFound = $("#FullNameList").data("kendoGrid").dataSource.data().some(
  function (dataItem) {
    return dataItem.FullName == searchName;        
  });

Some

The some() method tests whether at least one element in the array passes the test implemented by the provided function. It returns a Boolean value.

发布评论

评论列表(0)

  1. 暂无评论