下拉選單 篩選掉 不要的
順便一提 js 不像C# 他是有時間順序的!
<script>
$(function () {
var normalMark = JSON.parse('@Html.Raw(JsonConvert.SerializeObject(ItemsN))')
var importantMark = JSON.parse('@Html.Raw(JsonConvert.SerializeObject(ItemsI))')
$("#Mark_Type").on("change", function (e) {
var usage = $(e.target).val();
var tagBoxN = $("#Mark_Class_Normal_Arraywidget").dxTagBox('instance');
var tagBoxI = $("#Mark_Class_Important_Arraywidget").dxTagBox('instance');
if (usage) {
tagBoxI.option('dataSource', importantMark.filter(function (m) {
return m.Tag_Usage == usage;
}));
tagBoxN.option('dataSource', normalMark.filter(function (m) {
return m.Tag_Usage == usage;
}));
}
else {
tagBoxI.option('dataSource', []);
tagBoxN.option('dataSource', []);
}
});
$("#Mark_Type").change();
});
</script>
@using Newtonsoft.Json
@model IEnumerable<string>
@{
Html.DevExtreme()
.TagBox()
.ElementAttr(new { id = Html.Id("").ToHtmlString() + "widget" })
.Name("")
.ShowSelectionControls(true)
.AcceptCustomValue(false)
.SearchEnabled(true)
.ApplyValueMode(EditorApplyValueMode.UseButtons)
.Multiline(true)
.DisplayExpr("Tag_Name")
.SelectAllMode(SelectAllMode.Page)
.ValueExpr("Guid")
.Value(Model)
.Render();
}
歡迎高手低手來看看 指教指教 切磋切磋 教學香腸