On focus, select DropDownList existing entry for virtualized dropdown in grid

5 posts, 1 answers
  1. Richard
    Richard avatar
    8 posts
    Member since:
    Apr 2017

    Posted 04 May 2017 Link to this post

    Hello.  I'm using Kendo UI ASP.NET.  I have a grid with 2 dropdowns.  The first dropdown is not virtualized, the second one is (and also cascades off the first dropdown).  All of this works.

    I need to be able to quickly tab through all columns and rows in the grid using only the keyboard.  If the 2nd dropdown gets focus and the current value isn't yet loaded in the virtualized dropdown, I get stopped with a client-side "This value is required" error message.  I would like to know what the best strategy is to force the 2nd dropdown to navigate to the dropdown entry (in psuedocode, .select() to the virtualized, non-loaded entry) associated with its current value even when that entry is not yet loaded because of virtualization when that 2nd dropdown receives focus.

    Thanks,

    Richard

  2. Plamen
    Admin
    Plamen avatar
    2965 posts

    Posted 08 May 2017 Link to this post

    Hi,

    Unfortunately there is not dynamic way to select a non-loaded item from a virtualized DropDownlList.

    Regards,
    Plamen
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Richard
    Richard avatar
    8 posts
    Member since:
    Apr 2017

    Posted 08 May 2017 in reply to Plamen Link to this post

    Is there a way to bind .DataValueField when the grid is loaded without navigating to the virtualized entry in the DropDownList?  If I have AutoBind set to true, tabbing through the DropDownList works just fine for things "early" in the list that are already loaded.  AutoBind does not, however, appear to work for entries that aren't loaded.

    I just need the DropDownList to have a value in the data value field so I don't get the "no value" error.

    Side note:  Turning off validation doesn't help.  In this case, if I tab through the field, the DropDownList ends up with no value bound to it; I need the current .DataValueField to be bound to it in this use case.

  4. Answer
    Plamen
    Admin
    Plamen avatar
    2965 posts

    Posted 09 May 2017 Link to this post

    Hi,

    One possible solution I could think of is to set the initial Value property to some desired default value so that you can pass the no value error.

    Regards,
    Plamen
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  5. Richard
    Richard avatar
    8 posts
    Member since:
    Apr 2017

    Posted 09 May 2017 in reply to Plamen Link to this post

    That did it.  A very basic answer, I just had trouble asking the right question.  Simply set the default value by calling Value() on the DropDownList:

        Html.Kendo().DropDownListFor(model => model)
            .Value(Model.Description)

    Thanks!

Back to Top