From 74cd893846d253579d8b1ba9994e7bcf2c706efa Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Wed, 22 Feb 2023 14:02:28 +0700 Subject: [PATCH] Select UOM from master UOM --- edit-mode/function/function.js | 17 +++++++++++++++++ edit-mode/index.html | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/edit-mode/function/function.js b/edit-mode/function/function.js index d92e5f5..518eeb9 100644 --- a/edit-mode/function/function.js +++ b/edit-mode/function/function.js @@ -147,6 +147,23 @@ function getSatuan(){ } satuanList.push(satuan) }); + + // Clear the select element before appending new options + $('#uom-req-material').empty(); + + // Append the new options to the select element + satuanList.forEach((option) => { + let newOption = new Option(option.label, option.label); + $('#uom-req-material').append(newOption); + }); + + // Initialize select2 on the select element + $('#uom-req-material').select2({ + dropdownParent: materialModal, + placeholder: 'Pilih satuan', + allowClear: true + }); + if(satuanList.length > 0){ gantt.updateCollection("satuan", satuanList); gantt.refreshData(); diff --git a/edit-mode/index.html b/edit-mode/index.html index dfe1a13..9e94f73 100644 --- a/edit-mode/index.html +++ b/edit-mode/index.html @@ -284,7 +284,7 @@
- +