Fix parsing issues with auto complete

This commit is contained in:
George Kalampokis 2020-08-03 17:01:06 +03:00
parent cd5295437b
commit edf64328d9
1 changed files with 18 additions and 13 deletions

View File

@ -128,7 +128,10 @@ public class AutoCompleteData extends ComboBoxData<AutoCompleteData> {
if (data != null) {
this.multiAutoComplete = (Boolean) ((Map<Boolean, Object>) data).get("multiAutoComplete");
List<Map<String, Object>> dataList = (List<Map<String, Object>>) ((Map<String, Object>) data).get("autoCompleteSingleDataList");
List<Map<String, Object>> dataList = (List<Map<String, Object>>) ((Map<String, Object>) data).get("autocompleteSingle");
if (dataList == null) {
dataList = (List<Map<String, Object>>) ((Map<String, Object>) data).get("autoCompleteSingleDataList");
}
this.autoCompleteSingleDataList = new ArrayList<>();
@ -174,14 +177,15 @@ public class AutoCompleteData extends ComboBoxData<AutoCompleteData> {
List<Map<String, Object>> autoCompletes = new ArrayList<>();
NodeList autoCompleteSingles = item.getChildNodes();
for (int i = 0; i < autoCompleteSingles.getLength(); i++) {
if (autoCompleteSingles.item(i) instanceof Element && !((Element) autoCompleteSingles.item(i)).getTagName().equals("option")) {
if (autoCompleteSingles.item(i) instanceof Element) {
if (!((Element) autoCompleteSingles.item(i)).getTagName().equals("option")) {
Element node = (Element) autoCompleteSingles.item(i);
if (!node.hasChildNodes()) {
node.appendChild(node);
}
autoCompletes.add(singleToMap(node));
} else if (((Element) autoCompleteSingles.item(i)).getTagName().equals("option")) {
} else {
Element node = item.getOwnerDocument().createElement("autocompleteSingle");
node.appendChild(autoCompleteSingles.item(i));
node.setAttribute("url", item.getAttribute("url"));
@ -189,6 +193,7 @@ public class AutoCompleteData extends ComboBoxData<AutoCompleteData> {
autoCompletes.add(singleToMap(node));
}
}
}
dataMap.put("autocompleteSingle", autoCompletes);
//dataMap.put("optionsRoot", item != null ? item.getAttribute("optionsRoot") : "");
//Element optionElement = (Element) item.getElementsByTagName("option").item(0);