refactoring
This commit is contained in:
@@ -11,7 +11,7 @@ class PageInitializer {
|
||||
{
|
||||
selectElement: symptomSelectElement,
|
||||
textOfOption2Select: searchParam.get(),
|
||||
onValueSelected: (id, text) => {
|
||||
onSelectOptionHavingValueAndText: (id, text) => {
|
||||
prrByVaccineTableView.displayPrrByVaccineTable4Symptom(id, text);
|
||||
searchParam.set(text);
|
||||
},
|
||||
@@ -25,7 +25,7 @@ class PageInitializer {
|
||||
{
|
||||
selectElement: vaccineSelectElement,
|
||||
textOfOption2Select: searchParam.get(),
|
||||
onValueSelected: (id, text) => {
|
||||
onSelectOptionHavingValueAndText: (id, text) => {
|
||||
prrBySymptomTableView.displayPrrBySymptomTable4Vaccine(id, text);
|
||||
searchParam.set(text);
|
||||
},
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
class Select2 {
|
||||
|
||||
// FK-TODO: rename onValueSelected to onSelectOptionHavingValueAndText
|
||||
static initializeSelectElement({ selectElement, textOfOption2Select, onValueSelected, minimumInputLength }) {
|
||||
static initializeSelectElement(
|
||||
{
|
||||
selectElement,
|
||||
textOfOption2Select,
|
||||
onSelectOptionHavingValueAndText,
|
||||
minimumInputLength
|
||||
}) {
|
||||
selectElement.select2({ minimumInputLength: minimumInputLength });
|
||||
selectElement.on(
|
||||
'select2:select',
|
||||
function (event) {
|
||||
const id = event.params.data.id;
|
||||
const text = event.params.data.text;
|
||||
onValueSelected(id, text);
|
||||
onSelectOptionHavingValueAndText(id, text);
|
||||
});
|
||||
Select2.#selectOptionHavingText(selectElement, textOfOption2Select);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user