Bug Report T291786
Visible to All Users

GridLookup - The client-side ValueChanged event is not raised when changing a value via keyboard without opening the dropdown

created 9 years ago

I use a GridLookup instead of an Combobox. I do this because old inative products should no longer be selected by the user.
The control GridLookup works well, but if I change the value using the keyboard arrows then the Event ValueChanged is only triggerd when the grid view dialog is open. If the grid view dialog is closed and i use keyboard arrows to change the value then the value is indeed changed, but the event ValueChanged is not triggered.

File _GridLookupProduktartPartial.cshtml:

@using Bytergy.App_Code
@model Bytergy.Models.LoanPreCalculation.Vorkalkulation

var gridLookup = Html.DevExpress().GridLookup(s => {
ControlsHelper.DefaultSettings(s);
s.Name = "SelProduktartID";
s.KeyFieldName = "ID";
s.Width = 300;
s.GridViewProperties.CallbackRouteValues = new { Controller = "LoanPreCalculation", Action = "GridLookupProduktartPartial"};
s.Properties.SelectionMode = GridLookupSelectionMode.Single;
s.Properties.TextFormatString = "{0}";
s.GridViewProperties.Settings.ShowGroupPanel = false;
s.GridViewProperties.Settings.ShowFilterRow = false;
s.GridViewProperties.Settings.ShowColumnHeaders = true;
s.GridViewProperties.SettingsPager.Mode = GridViewPagerMode.ShowAllRecords;
s.GridViewProperties.SettingsBehavior.EnableRowHotTrack = true;
s.Properties.ClientSideEvents.ValueChanged = "OnChangedProduktartID";
s.Properties.ClientSideEvents.Init = "OnInitProduktartID";
s.Properties.ClearButton.DisplayMode = ClearButtonDisplayMode.OnHover;
s.Columns.Add(c =>
{
c.FieldName = "Name";
c.Caption = "Text";
c.Width = Unit.Pixel(300);
});
s.Columns.Add(c =>
{
c.FieldName = "KoreID";
c.Caption = "KoreID";
c.Width = Unit.Pixel(90);
});
s.Columns.Add(c =>
{
c.FieldName = "ID";
c.Caption = "Schlüssel";
c.Width = Unit.Pixel(55);
});
s.Columns.Add(c =>
{
c.FieldName = "Aktiv";
c.Caption = "Aktiv";
// c.Visible = true;
// c.Width = Unit.Pixel(55);
});
s.Columns.Add(c =>
{
c.FieldName = "IsKontokorrent";
c.Caption = "IsKontokorrent";
// c.Visible = true;
// c.Width = Unit.Pixel(55);
});
s.DataBound = (sender, e) =>
{
var gLookup = (MVCxGridLookup)sender;
gLookup.GridView.Width = 300;
gLookup.GridView.Settings.VerticalScrollBarMode = ScrollBarMode.Visible;
gLookup.GridView.Settings.VerticalScrollableHeight = 300;
};
s.GridViewProperties.BeforeGetCallbackResult = (sender, e) =>
{
var grid = (ASPxGridView)sender;
if (grid.VisibleRowCount <= 2)
grid.Settings.VerticalScrollBarMode = ScrollBarMode.Hidden;
};
s.GridViewProperties.HtmlRowCreated = (sender, e) =>
{
var valAktive = e.GetValue("Aktiv");
if (valAktive != null) {
bool aktiv = (bool)(e.GetValue("Aktiv"));
e.Row.Visible = aktiv;
}
else {
e.Row.Visible = true;
}
};
});
}
@gridLookup.BindList(ViewBag.ListProduktart).Bind(Model.ProduktartID).GetHtml()

File EditPage.cshtml:

<scripttype="text/javascript">
function OnInitProduktartID(s, e) {
SetVisibilityProduktartID(s);
}
function OnChangedProduktartID(s, e) {
SetVisibilityProduktartID(s);
}
function SetVisibilityProduktartID(s) {
var myVal = s.GetValue();
console.log("Produktart changed to name: " + myVal);
}
</script>
@Html.DevExpress().FormLayout(settings =>
{
 …
groupItem.Items.Add(i =>
{
ControlsHelper.DefaultSettings(i);
i.Caption = "Produktart";
i.SetNestedContent(() =>
{
Html.RenderAction("GridLookupProduktartPartial", new { model = Model });
});
});

Show previous comments (1)
DevExpress Support Team 9 years ago

    [This comment was created from a user's answer]

    Depending on the current value I hide/show other controls. With the attached sample project, the problem can be reproduced.
    [JScript]``````[ASPx]

    DevExpress Support Team 9 years ago

      [This comment was created from a user's answer]

      At the end of the video you can see that I leave the field with the mouse, however, the event is not fired.

      DevExpress Support Team 9 years ago

        Hello,

        Thank you for the provided video and project. I was able to reproduce this behavior, and it seems strange to me.
        I have forwarded this ticket to our developers for further research, and we will update it as soon as we have results.

        Regards,
        Pavlo

        Answers approved by DevExpress Support

        created 9 years ago (modified 9 years ago)

        We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

        Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

          Comments (1)
          HF HF
          Hermann FLORIAN 9 years ago

            Thanks for the hotfix. The event ValueChanged now triggers correctly.
            BR
            Hermann

            Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

            Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.