How do I modify the behaviour of a combobox that is in a Grid edit template?

2 posts, 0 answers
  1. Chris
    Chris avatar
    1 posts
    Member since:
    Jun 2012

    Posted 16 Jun 2016 Link to this post

    I have a Telerik MVC Grid and this has a popup editor for each row. The editor is configured like this:

    .Editable(e => e.Mode(GridEditMode.PopUp).TemplateName("MyItemEditor"))

    The "MyItemEditor" is a.cshtml file containing some controls, including a ComboBox.

    I want to modify the combo box in a couple of ways:

    (1) On focus it should automatically open its dropdown list of items.

    (2) When the user presses the Backspace key, all the text in the combo entry field should be deleted (not just the last character).

    I have managed to achieve these two things in a combo that is not inside a template, by running some jquery in the $(document).ready function to add extra events to the combo. But, when the combo is inside a template, the combo is not actually initialised until the popup is opened.

    Am I tackling this in the wrong way? Is there an "OnLoaded" event of the combo that I can hook into? I can't find one.


  2. Veselin Tsvetanov
    Veselin Tsvetanov avatar
    595 posts

    Posted 20 Jun 2016 Link to this post

    Hello Neil,

    I would suggest you to use the edit event of the Grid. It will be fired when you start editing your entry. At this stage the ComboBox should be already initialized and you will be able to attach you custom handlers.

    Simple implementation of the above could be found in this Dojo example.

    Veselin Tsvetanov
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top