Additional Data callback not sending combobox reference parameter to function

2 posts, 0 answers
  1. Peter
    Peter avatar
    14 posts
    Member since:
    Dec 2013

    Posted 20 Jul 2017 Link to this post

    According to your docs:

    There is a default event handler for the Data callback of the datasource. This event handler passes a reference to the combobox firing the event that can be resolved by running ".data("kendoComboBox")" against it.

    However if I manually hookup the same function, I get an error when typing something into the combox, because the "selector" parameter isn't actually a combobox.

    It appears to be a bug?

    I am trying to create a Data function that sends a reference to the combobox calling it as a parameter. And I cannot use strict ID selectors, because all my comboboxes have ID's that are generated dynamically at runtime.

  2. Veselin Tsvetanov
    Veselin Tsvetanov avatar
    747 posts

    Posted 24 Jul 2017 Link to this post

    Hi Peter,

    I am afraid, that you won't be able to retrieve the reference to the ComboBox with DataSource fires the Read action within the Data function. The reason for that is the fact that the DataSource is actually independent from the CombBox and does not know which ComboBox uses it. 

    As far as I can see from the ticket description, you are using the Telerik UI for ASP.NET MVC ComboBox helper. IF this is the case, you could workaround this limitation by passing a parameter (with the combo ID) to the Read action of the DataSource:
    source.Read(read =>
        read.Action("ReadProducts", "Home", new { testParam = [your combo id] } ).Data("additionalData");

    Then in the additionalData() function, the parameter could be retrieved from the request URL:
    function additionalData() {
        var comboId = this.url.split("?testParam=")[1];
        var combo = $('#' + comboId).data('kendoComboBox');

    You could find further information on this topic in the following forum thread.

    Veselin Tsvetanov
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top