我在我的angular 7应用程序中使用kendo Multiselect控件,可以看到数据可以当前绑定,但是选择项目确实会添加到控件中。 isItemSelected事件存在一些问题,但无法理解。不确定是什么问题
屏幕截图
JSON-货币
class PostListView(ListView):
model = models.ForumPost
template_name = "forum/post_list.html"
def get_context_data(self):
context = super().get_context_data()
return context
def get_queryset(self):
query_set = super().get_queryset()
return query_set
class CreatePostView(CreateView):
model = models.ForumPost
fields = ("title", "description")
template_name = "forum/create_post.html"
HTML
[{"Id":7,"Name":"AUD"},{"Id":10,"Name":"BND"},{"Id":19,"Name":"BRL"},{"Id":6,"Name":"CAD"},{"Id":5,"Name":"CHF"},{"Id":13,"Name":"CNH"},{"Id":12,"Name":"CNY"},{"Id":18,"Name":"DKK"},{"Id":3,"Name":"EUR"},{"Id":1,"Name":"GBP"},{"Id":9,"Name":"HKD"},{"Id":4,"Name":"JPY"},{"Id":14,"Name":"KRW"},{"Id":11,"Name":"KWD"},{"Id":17,"Name":"MYR"},{"Id":15,"Name":"NOK"},{"Id":16,"Name":"SEK"},{"Id":8,"Name":"SGD"},{"Id":2,"Name":"USD"}]
组件
<kendo-multiselect
[data]="LegalFundClasses.Currencies"
[(ngModel)]="value"
[textField]="Name"
[valueField]="Id"
[autoClose]="false"
>
<ng-template kendoMultiSelectItemTemplate let-dataItem>
<input type="checkbox" class="k-checkbox"
[checked]="isItemSelected(dataItem.Name)">
<label class="k-checkbox-label">{{ dataItem.Name }}</label>
</ng-template>
</kendo-multiselect>