第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在 Javascript 中填充默認下拉列表

如何在 Javascript 中填充默認下拉列表

C#
哈士奇WWW 2021-08-07 17:25:58
再會我下面的代碼將倉庫列表填充到下拉列表中,這是我想要的,但我也希望isMainWarehouse = true在填充倉庫時使用默認選擇的倉庫(請注意,只有一個主倉庫)function PopulateWarehouses() {var warehouseDropDown = document.getElementById('SelectWarehouse');var warehouseFragment = document.createDocumentFragment();_warehouseRepository.getWarehouses().done(function (data) {    for (var element in data.items) {        if (data.items.hasOwnProperty(element)) {            var recievedData = data.items[element];            var id = recievedData.id;            var name = recievedData.warehouseName;            var main = recievedData.isMainWarehouse;            var opt = document.createElement('option');            opt.innerHTML = name;            opt.value = id;            warehouseFragment.appendChild(opt);        }    }    warehouseDropDown.appendChild(warehouseFragment);    $('#SelectWarehouse').selectpicker('refresh');});}這是我的下拉菜單 <select id="SelectWarehouse" name="SelectWarehouse" class="selectpicker show-tick  form-control" data-live-search="true"></select>這個方法只是獲取所有倉庫的列表 // GET: get list of all warehouses    public async Task<ListResultOutput<WarehouseListDto>> GetWarehouses()   {        var warehouses = await _warehouseRepository.GetAllListAsync();        ListResultOutput<WarehouseListDto> dto = new ListResultOutput<WarehouseListDto>(                 warehouses                .OrderBy(t => t.WarehouseName)                .ToList()                .MapTo<List<WarehouseListDto>>()            );        return dto;    }
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 171 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號