我必须在模式窗口中放置一个下拉列表,因此我的html代码是:
<div id="windowPriceReviewDetail" kendo-window="" k-on-close="vm.onClose()" k-width="700" k-height="550" k-title="'SaveReview'" k-visible="false" k-modal="true">
<div class="row">
<div class="col-md-6">
<fieldset class="form-group col-md-8 col-xs-8 pull-right">
<label>Product Type</label>
<select kendo-drop-down-list="vm.CmProductType"
id="CmbProductType"
k-placeholder="'choose product'"
k-data-text-field="'ProductName'"
k-data-value-field="'ProductTypeId'"
k-filter="'contains'"
k-index="-1"
k-auto-bind="true"
k-data-source="vm.ProductTypeDataSource"
ng-model="vm.Product"
style="width: 100%"
ng-hide="vm.IsDisabledStep1">
</select>
<input type="text" class="form-control " ng-model="vm.ProductName" readonly ng-hide="!vm.IsDisabledStep1" />
</fieldset>
</div>
</div>
在我的控制器中,我这样描述了我的数据:
Product: number;
CmProductType: kendo.ui.ComboBox;
ProductId: number;
ProductName: string;
ProductTypeList: ProductTypeViewModel[] = [];
ProductTypeDataSource = new kendo.data.DataSource({
data: this.Product,
serverPaging: false,
autoSync: false,
pageSize: 10,
batch: false,
serverSorting: false,
serverFiltering: false
});
下拉列表中有静态数据,所以我显示如下:
GetProductType = () => {
var row = {} as ProductTypeViewModel;
row.ProductTypeId = 1;
row.ProductName = "Car1";
this.ProductTypeList.push(row);
var row = {} as ProductTypeViewModel;
row.ProductTypeId = 2;
row.ProductName = "Car2";
this.ProductTypeList.push(row);
this.ProductTypeDataSource.data(this.ProductTypeList);
}
但数据并没有显示在我的下拉列表中,我不知道下一步该怎么做!如果您知道typescript中模式窗口中的下拉列表,请帮助我。
暂无答案!
目前还没有任何答案,快来回答吧!