primefaces / primeui

Rich set of javascript-css only widgets
http://www.primefaces.org/primeui
278 stars 125 forks source link

Error: cannot call methods on puidropdown prior to initialization; attempted to call method 'option' #298

Closed hybitu closed 3 years ago

hybitu commented 4 years ago

I got this error, the first combobox, works perfectly but the second with the same code but different id, does not. Please could anyone give me any idea.

A B

$.ajax({ type: "GET", url: "controller/listA",
success: function(data, textStatus, jqXHR) { $("#a").puidropdown("option", "data", eval("(" + data + ")"));

                },
                error: function(jqXHR, textStatus, errorThrown) {
                    addPanMsgFrmTipoRecargoDescuento("error", {summary: "error:", detail: "xhr:  " + jqXHR + ", textStatus: " + textStatus + ", errorThrown: " + errorThrown});
                }

});

$.ajax({ type: "GET", url: "controller/listB",
success: function(data, textStatus, jqXHR) { //alert(data); $("#B").puidropdown("option", "data", eval("(" + data + ")")); }, error: function(jqXHR, textStatus, errorThrown) { addPanMsgFrmTipoRecargoDescuento("error", {summary: "error:", detail: "xhr: " + jqXHR + ", textStatus: " + textStatus + ", errorThrown: " + errorThrown}); } });