I am losing the selected value of my combo box column in my IGNITE UI Grid when the row enters Edit mode.
All of the data loads correctly initially, but when I double click on my row, the combo box column is cleared out.
I am setting up this column via the code below:
...
column.For(x => x.Size).HeaderText("Size").Width("10%").FormatterFunction("lookupBarSize");
cs.ColumnSetting().ColumnKey("Size").Required(true).EditorType(ColumnEditorType.Combo).ComboEditorOptions(co => co.RenderMatchItemsCondition(ComboRenderMatchItemsCondition.StartsWith).FilteringType(ComboFilteringType.Local).AutoComplete(true).DataSource(ViewBag.BarSizes).ValueKey("BarSzKey").TextKey("BarSzDesc"));
Here is my formatter function:
var sizeList = @Html.Raw(Json.Encode(ViewBag.BarSizes))
function lookupBarSize(val) { var i, size;
for (i = 0; i < sizeList.length; i++) { size = sizeList[i]; if (size.BarSzKey == $.trim(val)) { val = size.BarSzDesc; } }
return val; }
The ViewBag data is set in my Index Action in the Controller
Hi Dominick,
Thank you for posting in our forums! If the combo does not have value when you enter in edit mode means that such value does not exist in combo’s data source. If you want to keep the value in the combo you should set the allowCustomValue option to true in the ComboEditorOptions section.
Please let me know if this works for you!
Kind regards, Petko Zhekov Software Engineer
Hello Dominik,
Please feel free to contact me if you have any additional questions regarding this matter.