i have this istruction:
DialogCard.Add(new KanbanDialogModels { key = "Status", type = "DropDown" });
how can I populate the dropdown with a list of values?
|
<ejs-kanban id="Kanban" keyField="Status" dataSource="@ViewBag.data" dialogOpen="onDialogOpen" created="onKanbanCreated">
. . .
<e-kanban-dialogsettings template="#dialogTemplate"></e-kanban-dialogsettings>
</ejs-kanban>
<script id='dialogTemplate' type="text/x-template">
<table>
<tbody>
<tr>
<td class="e-label">ID</td>
<td>
<input id="Id" name="Id" type="text" class="e-field" value="${Id}" disabled required />
</td>
</tr>
<tr>
<td class="e-label">Status</td>
<td>
<input type="text" name="Status" id="Status" class="e-field" value=${Status} required />
</td>
</tr>
<tr>
<td class="e-label">Assignee</td>
<td>
<input type="text" name="Assignee" id="Assignee" class="e-field" value=${Assignee} />
</td>
</tr>
<tr>
<td class="e-label">Priority</td>
<td>
<input type="text" name="Priority" id="Priority" class="e-field" value=${Priority} />
</td>
</tr>
<tr>
<td class="e-label">Summary</td>
<td>
<textarea type="text" name="Summary" id="Summary" class="e-field" value=${Summary}>${Summary}</textarea>
<span class="e-float-line"></span>
</td>
</tr>
</tbody>
</table>
</script>
<script>
. . .
var priorityData = ['Low', 'Normal', 'Critical', 'Release Breaker', 'High'];
. . .
function onDialogOpen(args) {
if (args.requestType !== 'Delete') {
var curData = args.data;
. . .
var priorityObj = new ej.dropdowns.DropDownList({
value: curData.Priority, popupHeight: '300px',
dataSource: priorityData, fields: { text: 'Priority', value: 'Priority' }, placeholder: 'Priority'
});
priorityObj.appendTo(args.element.querySelector('#Priority'));
. . .
}
}
. . .
</script> |
inside c# model it's possible?
public class KanbanDialogModels
{
public string text { get; set; }
public string key { get; set; }
public string type { get; set; }
public List
{
List
DialogCard.Add(new KanbanDialogModels { key = "Status", type = "DropDown", value = new string[] {"Low", "Normal", "Critical", "Release Breaker", "High" }
});
DialogCard.Add(new KanbanDialogModels { key = "Title", type = "TextArea" });
DialogCard.Add(new KanbanDialogModels { key = "Description", type = "TextArea" });
return DialogCard;
}
}
|
public class KanbanDialogModels
{
public string text { get; set; }
public string key { get; set; }
public string type { get; set; }
public string[] value { get; set; } }public IActionResult Index()
{
ViewBag.data = new KanbanDataModels().KanbanTasks();
ViewBag.status = new KanbanDataModels().DialogStatus();
ViewBag.assignee = new KanbanDataModels().AssigneeData();
ViewBag.priority = new KanbanDataModels().PriorityData();
List<KanbanDialogModels> DialogCardFields = new List<KanbanDialogModels>();
DialogCardFields.Add(new KanbanDialogModels { text = "ID", key = "Title", type = "TextBox" });
DialogCardFields.Add(new KanbanDialogModels { key = "Status", type = "DropDown", value = new string[] { "Open", "InProgress", "Testing" } });
DialogCardFields.Add(new KanbanDialogModels { key = "Assignee", type = "DropDown" });
DialogCardFields.Add(new KanbanDialogModels { key = "RankId", type = "TextBox" });
DialogCardFields.Add(new KanbanDialogModels { key = "Summary", type = "TextArea" });
ViewBag.dialogData = DialogCardFields;
return View(); } |
|
<e-kanban-columns>
<e-kanban-column headerText="To Do" keyField="Open"></e-kanban-column>
<e-kanban-column headerText="In Progress" keyField="InProgress"></e-kanban-column>
<e-kanban-column headerText="Testing" keyField="Testing"></e-kanban-column>
<e-kanban-column headerText="Done" keyField="Close"></e-kanban-column>
</e-kanban-columns>
<e-kanban-cardsettings headerField="Id" contentField="Summary"></e-kanban-cardsettings>
<e-kanban-dialogsettings fields="@ViewBag.dialogData"></e-kanban-dialogsettings> </ejs-kanban><script>
function onDialogOpen(args) {
args.element.querySelector(".Status_wrapper .e-control.e-dropdownlist").ej2_instances[0].dataSource = this.dialogSettings.properties.fields[1].value;
} </script> |
good...very good...
but i must remove .Status_wrapper
|
function onDialogOpen(args) {
args.element.querySelector(".e-control.e-dropdownlist").ej2_instances[0].dataSource = this.dialogSettings.properties.fields[1].value; } |
excellent...