<div style="padding:5%;">
@(Html.EJS()
.DropDownList("games")
.Placeholder("Select a game")
.DataSource((IEnumerable<DropdownlistGameList>)ViewBag.data)
.Fields(new DropDownListFieldSettings { Text = "Game", Value = "Id" })
.ItemTemplate(
"<div><img class=\"empImage\" src=\"/Content/combobox/images/Employees/${Id}.png\"/>" +
"<div class=\"ename\"> ${Game} </div></div>")
.Open("itemdatabound")
.Render())
</div>
<script>
function itemdatabound(args) {
// find the list items
var itemList = args.popup.element.querySelectorAll(".e-list-item");
for (var item = 0; item < itemList.length; item++) {
if (args.popup.element.querySelectorAll(".e-list-item")[item].getAttribute('data-value') === "Game4") {
// set the styles with specific condiotions
args.popup.element.querySelectorAll(".e-list-item")[item].setAttribute("style", "background-color: #F3C3C3; color: red;");
}
}
}
</script> |
Hi Sureshkumar,
<div style="padding:5%;">
@(Html.EJS()
.DropDownList("games")
.Placeholder("Select a game")
.DataSource((IEnumerable<DropdownlistGameList>)ViewBag.data)
.Fields(new DropDownListFieldSettings { Text = "Game", Value = "Id" })
.ItemTemplate(
"<div><img class=\"empImage\" src=\"/Content/combobox/images/Employees/${Id}.png\"/>" +
"<div class=\"ename\"> ${Game} </div></div>")
.DataBound("itemdatabound")
.Open("popupOpen")
.Render())
</div>
<script>
function itemdatabound(args) {
var remotedata;
var data = new ej.data.DataManager({
url: "/Home/GetAllStatusColor", adaptor: new ej.data.WebApiAdaptor(), offline: true
}).executeQuery(new ej.data.Query())
.then(function (e) {
remotedata = e.result;
});
}
function popupOpen(args) {
// find the list items
var itemList = args.popup.element.querySelectorAll(".e-list-item");
for (var item = 0; item < itemList.length; item++) {
if (args.popup.element.querySelectorAll(".e-list-item")[item].getAttribute('data-value') === "Game4") {
// set the styles with specific condiotions
args.popup.element.querySelectorAll(".e-list-item")[item].setAttribute("style", "background-color: #F3C3C3; color: red;");
}
}
}
</script> |
Able to resolve this now. Thanks Sureshkumar!