Hi All,
We have a table for managing a business process that needs to display an item from the inventory tables. Therefore we need the column showing what Item a record will use to be a ForeignKey column. We have had various problems getting this to work, and our best solution so far is still not functional. The DropDownList just closes as soon as you click into it. It is bound with server filtering.
The column definition:
columns.ForeignKey(p => p.ItemMasterId, ds => ds.Read(r => r.Action("ItemMasters", "MasterMix")), "ItemId", "ItemName", true)
.Title("Item Name").Width(500).EditorTemplateName("ItemMasterDropDownEditor");
The editor template:
@model object
@(Html.Kendo().DropDownListFor(model => model)
.DataSource(source =>
{
source.Read("ItemMasters", "MasterMix").ServerFiltering();
})
.Filter(FilterType.Contains)
.DataValueField("ItemId")
.DataTextField("ItemName")
)
The server-side call:
public ActionResult ItemMasters(string text){
var itemMasters = string.IsNullOrEmpty(text) ? db.ItemMasters.OrderBy(o => o.ItemName).Select(p => new ItemMasterVM(p.Id, p.ItemName)).ToList()
: db.ItemMasters.OrderBy(o => o.ItemName).Where(e => e.ItemName.ToLower().Contains(text.ToLower())).Select(p => new ItemMasterVM(p.Id, p.ItemName)).ToList();
return Json(itemMasters);
}
The list is working correctly showing all we need. We just can't get the dropdown to stay open and have the cursor in the filter search text box.
Thanks in advance... Bob Graham