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 7809725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:31:47+00:00 2026-06-02T03:31:47+00:00

I hope my title isn’t too confusing. An example first. I have the following

  • 0

I hope my title isn’t too confusing. An example first. I have the following code that configures the read operation for a Kendo UI data source. I am trying to filter all reads based on the selected company id, but my getSelectedCompanyId function is only ever called once, when the page loads. The code below is too long to include all here, so just an excerpt.

$(function () {
    function getSelectedCompanyId() {
        var id = $("#CompanyId").val();
        return id;
    }

    $("#CompanyId").kendoDropDownList({
        change: function () {
            grid.dataSource.read();
        }
    });
    var departmentIndexDataSource = new kendo.data.DataSource({
        transport: {
            read: {
                url: '@Url.Action("ListForCompanyIdJson", "Department")' + '?companyId=' + getSelectedCompanyId(),
                type: "GET"
            },

The ListForCompanyIdJson action is always called with the value selected in the dropdown when $("#CompanyId").kendoDropDownList() is called. I want this function to be called whenever I call grid.dataSource.read().

I realize this might be highly specific to the Kendo stuff, but maybe it’s something I can solve with plain JavaScript closures and some help.

  • 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-02T03:31:48+00:00Added an answer on June 2, 2026 at 3:31 am

    You could install a replacement function for grid.dataSource.read() that always calls your function first and then calls grid.dataSource.read().

    For example:

    grid.dataSource.oldRead = grid.dataSource.read;
    grid.dataSource.read = function() {
        // call your function here
        return grid.datasource.oldRead.apply(this, arguments);
    }
    

    Or, if you want to be able to call one sometimes and one other times, you can just make a new method that provides the new behavior and use it when you want to:

    grid.dataSource.myread = function() {
        // call your function here
        return grid.datasource.read.apply(this, arguments);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hope that title isn't too cryptic. I have an array with a DATETIME object
I hope the title isn't too confusing, I'll try to explain better below. Suppose
Hope the title wasn't too confusing. I have a directory full of files which
I hope the title makes sense. I have a set of items that I
I hope the title is not too confusing. I am trying to make folders
Hope the title is not that confusing - honestly said I had no idea
I hope that title is clear enough. I have 2 projects, MyProject.Website (ASP.NET MVC3
Hope someone understood the title... Let's say I have the following relation, Animals HABTM
I hope that the title and this simple example says everything. public partial class
Title is bad, Hope the example will clarify this. I have an event. Event

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.