Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9205507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:57:57+00:00 2026-06-17T23:57:57+00:00

My requirement is to loop through all selected rows of a grid and set

  • 0

My requirement is to loop through all selected rows of a grid and set a field on the datasource with a given value. I have the following code and iterate through selected rows of a kendo ui grid.

$('#grid').data("kendoGrid").select().each(function () {
                if($('#grid').data().kendoGrid.dataSource.data()[$(this).index()] != null ){

                    var myItem = $('#grid').data().kendoGrid.dataSource.data()[$(this).index()];
                    myItem.set(myFiled, myValue);
                    leg.push(myItem);

                }
            });

The problem is that after my code reaches on the line myItem.set(myFiled, myValue); the index gets the value -1 and it keeps this value even on my next iteration.

When removing the .set method i see that i do not have the same behaviour and my index keeps the correct value. Why is is this happening ?

Furthermore, what is the difference between the line:

i) $(‘#grid’).data(“kendoGrid”).dataItem($(this)).set(myField, myValue);

ii) $(‘#grid’).data().kendoGrid.dataSource.data()[$(this).index()].set(myField, myValue);

I know that the first has to do with the values on the grid. Unfortunately i never managed to set the values as shown on (i) . The code shown on line (i) does not seem to work with the set function at all.

I took my examples from here Refresh a single Kendo grid row and Kendo-UI grid Set Value in grid with Javascript for the cases (i) and (ii) .

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T23:57:58+00:00Added an answer on June 17, 2026 at 11:57 pm

    I found a solution/workaround. Although i still do not understand why a kendo grid index has this behaviour.

    Instead of using inside my iteration the myItem.set(myField, myValue); i changed my code to myItem[myField] = myValue;

    With this method the value was changed, the change event was not triggered (as required) and the index was keeping it’s value as also required.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a requirement where i need to loop through JSON Format data and
I have a requirement to Save a datasource from a database query to memory
I want to be able to loop through all the fields on a form
I have the following code: for (i = 1; i <= loopsNeeded; i++) {
I have the following requirement: - I have many (say 1 million) values (names).
I'm looking to loop through a JSON array and display the key and value.
I have the following requirement. Ex: There is a transaction table where it has
Requirement I have an application with 2 activities, say A and B , with
Requirement is this ... We have our 3 web-applications deployed in RHEL-5 server, we
Requirement of my app is to have UINavigationController at the bottom with play, rewind

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.