Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
140977 | Nov 16,2018 02:30 PM UTC | Nov 19,2018 09:52 AM UTC | ASP.NET Core - EJ 2 | 1 |
![]() |
Tags: ComboBox |
<script>
function runComboBoxCostElementDefault() {
let comboBoxObject = new ej.dropdowns.ComboBox({
dataSource: @Html.Raw(JsonConvert.SerializeObject(ViewBag.source)),
fields: {
text: "Id",
value: "Id"
},
// set the template content for list items
itemTemplate: ' ${Id}-${FirstName} ${LastName}',
htmlAttributes: {
name: "UserId"
},
value: 1,
allowCustom: false,
popupHeight: "230px",
zIndex: 9999,
allowFiltering:true,
filtering: (e) => {
if (e.text!="") {
var predicate = new ej.data.Predicate('FirstName', 'contains', e.text, true);
predicate = predicate.or('LastName', 'contains', e.text);
var query = new ej.data.Query();
query = (e.text !== '' && e.value !== '') ? query.where(predicate) : query;
e.updateData(@Html.Raw(JsonConvert.SerializeObject(ViewBag.source)), query);
}
}
});
comboBoxObject.appendTo('#userComboBox');
}
</script> |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.