I have a grid which has a column whose editor is set to Combo. It gets data from the DatasourceUrl, I want to make an ajax request on the selection changed event of that combo. How can I do that ?
Q: How can I register or set an event handler for the combo inside the grid.
Thanks in advance.
Thanks Martin,
I am using MVC Helper syntax like this :
cs.ColumnSetting().ColumnKey("cur_cd").EditorType(ColumnEditorType.Combo).Required(true) .ComboEditorOptions(co => co.DataSourceUrl("/mycontroller/getData").TextKey("cur_cd").ValueKey("cur_name") .Mode(ComboMode.DropDown));
In this syntax, .AddClientEvent("selectionChanged", "myFunction"); is not available in the intellisense on indivisual columns like this:
cs.ColumnSetting().ColumnKey("cur_cd").EditorType(ColumnEditorType.Combo).Required(true) .ComboEditorOptions(co => co.DataSourceUrl("/mycontroller/getData").TextKey("cur_cd").ValueKey("cur_name") .Mode(ComboMode.DropDown).AddClientEvent("selectionChanged", "myFunction")); (Error)
However it is available immediately after features.Updating() like this :
features.Updating().AddClientEvent("selectionChanged", "myFunction") (Works)
I want to register the event only on cur_cd column & not on all columns, also if it cannot be done in MvcHelper syntax , How can I detect which column's selection changed is fired in the delegate handler, is there something like ui.columnKey something like that to determine which column's selection change is being fired.
One more thing , You can see in my .ComboEditorOptions that TextKey is cur_cd, ValueKey is cur_name , How ever I want TextKey= cur_name & ValueKey=cur_cd but this gives an error for some reason and works fine the other way BUT I see cur_cd as display text in the combo which I dont want, When I select an item than the selected item(after dropdown closes) becomes cur_name, but in the dropdown list it shows cur_cd. Any idea why this strange behavior ?
Hello Jimmy,
In the editor options settings you can directly define the event handler like this:
Hope this helps,Martin PavlovInfragistics, Inc.