I am working with AutoComplete in a grid cell. I need the dropdown display for the filter to be different than the value that populates the field once a value is selected. The stored procedure that returns the values to be searched/filtered combines several fields so the users can filter several fields at once. However, I don't want the final selected value displayed to be that field but another shortened field. In my example, the filtering is done on a combination of "ProjectNumber" and "ProjectName" while the final selected value displayed should only be the ProjectNumber.
This isn't an issue once the user presses the Bulk Save button on the grid as the read returns only the ProjectNumber for the grid field but I need to display only the ProjectNumber once an autocomplete value is selected.
@(Html.Kendo().AutoComplete()
.Name("")
.Filter(FilterType.Contains)
.DataTextField("ProjectLookup")
.Value("ProjectKey")
.ValuePrimitive(true)
.Placeholder("Select...")
.Template("#= ProjectNumber # | #= ProjectName #")
.AutoWidth(true)
.MinLength(1)
.DataSource(dataSource =>
{
dataSource.Ajax();
dataSource.Read(read =>
{
read.Action("ProjectAutoComplete_Read", "Timecard").Data("projectAutoCompleteRead");
})
.ServerFiltering(false);
})
.Events(events => events
.Select("projectAutoComplete_OnSelect")
.Filtering("projectAutoComplete_OnFiltering")
.Change("projectAutoComplete_OnChange")
)
)