|
[View]
<ejs-multiselect id="games" dataSource="@ViewBag.data" tagging="onTagging" placeholder="Favorite Sports" value="@ViewBag.value" mode="Default">
<e-multiselect-fields value="Id" text="Game"></e-multiselect-fields>
</ejs-multiselect>
[Controller]
public IActionResult chipcustom()
{
ViewBag.value = new string[] { "Game1", "Game4", "Game7" };
ViewBag.data = new GameList().GameLists();
return View();
}
|
|
<div class="control-section">
<div id='local-data'>
<div class='control-wrapper'>
<h4> Local Data</h4>
<ejs-multiselect id="local" placeholder="Select" dataSource="@ViewBag.localdata" popupHeight="200px" mode="CheckBox" showSelectAll="true" hideSelectedItem="true" openOnClick="true" allowFiltering="true" showClearButton="true">
<e-multiselect-fields text="Name" value="ServiceId"></e-multiselect-fields>
</ejs-multiselect>
</div>
</div>
<div class="control-section">
<div class="schedule-wrapper">
<ejs-schedule id="schedule" height="550" popupOpen="onAppointmentWindowOpen" selectedDate="new DateTime(2018, 2, 15)" eventRendered="OnEventRendered">
<e-schedule-eventsettings dataSource="@ViewBag.appointments"></e-schedule-eventsettings>
</ejs-schedule>
</div>
</div>
<script type="text/javascript">
function OnEventRendered(args) {
var scheduleObj = document.getElementById('schedule').ej2_instances[0];
var categoryColor;
var start = new Date(args.data.StartTime).setHours(0, 0, 0, 0);
var end = new Date(args.data.EndTime).setHours(0, 0, 0, 0);
if (args.data.IsAllDay) {
categoryColor = '#8e24aa';
}
else if (start !== end) {
categoryColor = '#f57f17';
}
else {
categoryColor = '#7fa900';
}
if (scheduleObj.currentView === 'Agenda') {
args.element.firstChild.style.borderLeftColor = categoryColor;
}
else {
args.element.style.backgroundColor = categoryColor;
}
}
function onAppointmentWindowOpen(args) {
var msObject = document.getElementById("local").ej2_instances[0];
var SelectedServices = "3,2";
var str_array = SelectedServices.replace(/["']/g, "").split(',');
msObject.value = str_array; // set the value
}
</script>
|