mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 01:24:38 +00:00
tokenize2 fix for https://github.com/opnsense/core/issues/3760
a4217d8fcc calls tokenize2() before it seems to be inititalized, lets check for content before calling clear.
This commit is contained in:
parent
89918fc1de
commit
7a5a2712cd
@ -135,13 +135,13 @@ function setFormData(parent,data) {
|
||||
// data node found, handle per type
|
||||
if (targetNode.is("select")) {
|
||||
// handle select boxes
|
||||
targetNode.empty(); // flush
|
||||
if (targetNode.hasClass("tokenize")) {
|
||||
if (targetNode.find('option').length > 0 && targetNode.hasClass("tokenize")) {
|
||||
// when setting the same content twice to a widget, tokenize2 sorting mixes up.
|
||||
// Ideally formatTokenizersUI() or tokenize2 should handle this better, but for now
|
||||
// this seems like the only fix that actually works.
|
||||
targetNode.tokenize2().trigger('tokenize:clear');
|
||||
}
|
||||
targetNode.empty(); // flush
|
||||
$.each(node[keypart],function(indxItem, keyItem){
|
||||
var opt = $("<option>").val(htmlDecode(indxItem)).text(keyItem["value"]);
|
||||
if (keyItem["selected"] != "0") {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user