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

ComboBox Virtual Scrolling uses wrong value

2 Answers 208 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Tom
Top achievements
Rank 1
Tom asked on 14 Jan 2019, 04:02 PM

We are experiencing an issue with the virtual scrolling of a combobox when used as a custom editor template in a grid with in-cell editing. I have a solution to demonstrate the issue, but it is too large to upload.

Basically, when clicking into the combobox, the control is bound and looking at the web requests, the value is passed correctly to the ValueMapper and the index is retrieved correctly from the server. However, if you then TAB or press ENTER in the combobox, it attempts to retrieve the value based on the text in the combobox, clearing the reference.

2 Answers, 1 is accepted

Sort by
0
Tom
Top achievements
Rank 1
answered on 14 Jan 2019, 04:09 PM

This is the grid definition

@(Html.Kendo().Grid<VirtualComboBoxIssueDemo.Models.OrderViewModel>
    ()
    .Name("grid")
    .Columns(columns =>
    {
    columns.Bound(p => p.OrderID).Filterable(false);
    columns.Bound(p => p.Freight);
    columns.Bound(p => p.OrderDate).Format("{0:MM/dd/yyyy}");
    columns.Bound(p => p.ShipName);
    columns.Bound(p => p.ShipCity);
    columns.Bound(x => x.Reference).ClientTemplate("#= Reference ? Reference.DisplayText : '' #");
    })
    .Pageable()
    .Editable(e => e.Enabled(true).Mode(GridEditMode.InCell))
    .Sortable()
    .Scrollable()
    .Filterable()
    .HtmlAttributes(new { style = "height:550px;" })
    .DataSource(dataSource => dataSource
    .Ajax()
    .PageSize(20)
    .Read(read => read.Action("Orders_Read", "Grid"))
    .Update(x => x.Action("Update", "Grid"))
    )
    )

 

This is the grid model

public class OrderViewModel
    {
        public int OrderID
        {
            get;
            set;
        }
 
        public decimal? Freight
        {
            get;
            set;
        }
 
        [Required]
        public DateTime? OrderDate
        {
            get;
            set;
        }
 
        public string ShipCity
        {
            get;
            set;
        }
 
        public string ShipName
        {
            get;
            set;
        }
        [UIHint("RefItem")]
        public ReferenceItem Reference { get; set; }
    }
 
    public class ReferenceItem
    {
        public int Id { get; set; }
        public string DisplayText { get; set; }
    }

This is the GetReferenceData and GetIndex methods

public IActionResult GetReferenceData([DataSourceRequest]DataSourceRequest request) => Ok(GetReferenceItems().ToDataSourceResult(request));
public IActionResult GetIndex(int id) => Ok(id - 1);
 
private IEnumerable<ReferenceItem> GetReferenceItems() => Enumerable.Range(1, 1000).Select(x => new ReferenceItem { Id = x, DisplayText = $"Item {x}" });

 

 

0
Veselin Tsvetanov
Telerik team
answered on 17 Jan 2019, 01:29 PM
Hello Tom,

Just in case other developers meet the same issue, I will include below my answer from the суппорт thread, that you have opened on the same topic.

The observed issue is caused by the following regression bug. The ComboBox changes its value to its input field content when the drop-down has not been opened and the Tab or Enter key is pressed. The above bug has been fixed and the fix is available in our R1 2019.1.115 release. To avoid that issue, I would suggest you to update your project to that version. 

Regards,
Veselin Tsvetanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
ComboBox
Asked by
Tom
Top achievements
Rank 1
Answers by
Tom
Top achievements
Rank 1
Veselin Tsvetanov
Telerik team
Share this question
or