I am trying to populate kendo multiselect control. The data does bind to the control and I can see all the currencies from the currencies object but it inst showing the previously selected currencies that is in the ngmodel. How do I show the selected currencies ?
<kendo-multiselect [data]="LegalFundClasses.Currencies" style="height: 29.5px;"
[(ngModel)]="f.OtherCurrencyName" [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"></label>
</ng-template>
</kendo-multiselect>
Component
public value: any = [{ Id: null, Name: "" }];
public isItemSelected(itemText: string): boolean {
return this.value.some(item => item.Name === itemText);
}
Currencies object
"Currencies": [
{
"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"
}]
NgModel
The f.OtherCurrencyName that is assinged to the ngModel contains a string value of 10,19,7 which is comma seperated.
from Kendo Multiselect not showing the previously selected items
No comments:
Post a Comment