This is a migrated thread and some comments may be shown as answers.

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

1 Answer 61 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Andy
Top achievements
Rank 1
Andy asked on 16 Jun 2016, 08:59 AM

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.

Thanks

1 Answer, 1 is accepted

Sort by
0
Veselin Tsvetanov
Telerik team
answered on 20 Jun 2016, 06:35 AM
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.

Regards,
Veselin Tsvetanov
Telerik
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
Tags
ComboBox
Asked by
Andy
Top achievements
Rank 1
Answers by
Veselin Tsvetanov
Telerik team
Share this question
or