TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Cassie Mod
NA
488
70.1k
check if Kendo grid contains item
Feb 28 2018 4:48 AM
HI, ive got the following question. We have a kendo grid.
but how can i check if the kendo grid contains a specific item ?
this is wat i have so far:
<script>
$(function() {
$(
'form'
).on(
'submit'
,
function(e) {
@* Add the data from the grids *@
var numbers = $(
"#NumberGrid"
).data(
'kendoGrid'
).dataSource.view().toJSON();
$(
'#@Html.IdFor(m => m.NumbersJson)'
).val(JSON.stringify(numbers));
// client side validation
var lineGroupId = $(
'#@Html.IdFor(m => m.LineGroupId)'
).val();
// check if lineGroupId is in numbers (if value is set)
var lineGrouIdIsInNumbers =
false
;
// code to check number in list
var numbersData = numbers.dataSource.data();
for
(var i = 0; i < numbersData.length; i++) {
var numberdata = numbersData[i];
var number = numberdata.value;
if
(number === lineGroupId) {
lineGrouIdIsInNumbers =
true
;
}
}
if
(lineGrouIdIsInNumbers ===
false
) {
// enable button and change text
$(
"#submitButton"
).prop(
'disabled'
,
false
).val(valueOfSubmitButton);
// show error message (under submit button)
// return false ( or prevent default action)
e.preventDefault();
//return false;
}
});
However the page is crashing and i think it is because of my for loop to check if the number exists in the grid , so how can i fix this ?
thnx guys
Reply
Answers (
0
)
Microservices: How to set network path of folder structure
ajax control toolkit