I want to know when users has changed some data in the form, for example when a combo has changed its value, so I do this:
$(function () { $(document).delegate("#StyleKey", "igcomboselectionchanged", function (evt, ui) { document.getElementById("FormDataHasChanged").value = true; });}
But this is fired even when user hasn't change the combo value. How to prevent this event to be fired until everything is loaded?
Hi Nikolay, thank you for your help. I found the problem with my code. In the next piece of code selectionChanged event is fired, but if you uncomment DataSource then it will not be fired. I am setting a DataSource to be sure that the item will be shown even if it is not in the first page (my personal workaround for that other issue). In this example I am using CategoryId instead of StyleKey, doesn't matter.
@(Html.Infragistics().ComboFor(pModel => pModel.CategoryId) .LoadOnDemandSettings(pLoad => pLoad.Enabled(true).PageSize(25)) //.DataSource((List<Category>)ViewBag.Category) // Uncomment DataSource to fix the issue. .DataSourceUrl(@Url.Action("GetCategories")) .ValidatorOptions(pOpt => pOpt.KeepFocus(ValidatorKeepFocus.Once).Required(true).OnBlur(true)) .ValueKey("Id") .TextKey("Name") .Width("450px") .HeaderTemplate("<div class='dropDownHeaderFooter'>" + "Categories" + "</div>") .FooterTemplate("<div class='dropDownHeaderFooter'>" + "Available" + " {0} / {3}</div>") .FilteringType(ComboFilteringType.Remote) .DataBind() .Render())
For now I am satisfied. Thanks for your time Nikolay.
Hi, Luis.
The selectionChanged event is fired, when an item from the combo drop down is selected. It should not fire in other cases, so if you want to investigate further, please send me the code you are using.
Even I think the selectionChanged event cannot not be the best candidate for getting to know, when the combo value is changed, because in cases when you directly write in the input of the combo, the selectionChanged event is not fired. In such cases, you can use the textChanged event.
One other note is that you can always cancel the event by returning false inside the handler:
$(document).delegate("#StyleKey", "igcomboselectionchanged", function (evt, ui) { return false;});
I cannot understand, why this event is fired before everything is loaded? Do you mean that the event is fired, before the combo is loaded? This should not happen. If you send me a bigger piece of your code, I will be able to answer you with more details.
I will wait for you feedback. Thanks for using our product!Best regards,Nikolay Alipiev