Paulsonps / dropdown-check-list

Automatically exported from code.google.com/p/dropdown-check-list
0 stars 0 forks source link

After submit form, cannot locate (dropdownchecklist/select) object #228

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
** What steps will reproduce the problem?
I am refreshing the list of elements perfectly via an ajax statement.

1) .dropdownchecklist("destroy") function
2) Update select box with new list
3) .dropdownchecklist( {icon: {}, width: 220, maxDropHeight: 300, zIndex: 500 } 
)

However, After submitting the form, the same "refresh" script crashes with the 
error described below.

** What is the expected output? What do you see instead?
Dropdown should perform the same before/after form submission.

Receive Error: Uncaught TypeError: Object [object Object] has no method 
'dropdownchecklist'

Error received On line:
$("#rnc").dropdownchecklist("destroy");

** What is your environment?
-- DropDownCheckList version: 1.4
-- jQuery version: 1.62
-- jQuery UI version: 1.8.15
-- Browser and version: Google Chrome 16.0.912

** Please provide any additional information below/Please attach**

function updateRNC(){
$("#rnc").dropdownchecklist("destroy");
$("#rncloading").show();
var rnc_type = $("input[name='E_TYPE']:checked").val() 
$.get("ajax.php",{submarket: $("#market").val(), type: rnc_type }, function(j){
 var options = "<option value='SUMMARY' selected>Overview (or select RNC)</option>";
 options += "<option value='ALL'>*ALL "+rnc_type+"*</option>";
 for (var i = 0; i < j.length; i++) {
 options += '<option value="' + j[i] + '">' + j[i] + '</option>';
 }
 $("select#rnc").html(options);
 $("#rncloading").hide();
 $("#rnc").dropdownchecklist( {icon: {}, width: 220, maxDropHeight: 300, zIndex: 500 } ); 
});
}

Original issue reported on code.google.com by Ryan.Gar...@gmail.com on 30 Jan 2012 at 7:54

GoogleCodeExporter commented 8 years ago
Sorry, but without a test environment similar to what you are doing with Ajax, 
I really can be of little help. The error that is being reported seems to 
indicate that DDCL has not yet been applied to the SELECT#rnc.  Its almost as 
though you are destroying the DDCL before it have been recreated. 

You might want to try running with non-minimized version of DDCL and setting 
breakpoints on the DDCL creation and destroy, just to ensure that DDCL has been 
properly rebuilt before you attempt the second destroy.

Original comment by womohun...@ittrium.com on 6 Feb 2012 at 3:10

GoogleCodeExporter commented 8 years ago
The form was returning a "new" html document with <html><body> tags which were 
being inserted into a <div>. DDCL was probably looking for the [object] in the 
new html. I had to code around so that the form only returned the results into 
the <div> and not a whole new html. Working great now.

Original comment by Ryan.Gar...@gmail.com on 15 Feb 2012 at 4:40