RajeshChaudhary345 / dropdown-check-list

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

Need to load the dropdownchecklist with newest data #207

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
** What steps will reproduce the problem?
I have a states dropdownchecklist which I can select a state or multiple states 
and then I can load and the city dropdownchecklist, I am using ajax to do a 
post and then from code I return Json back after I get a new city list. The 
data is value, text, selected
example (value = Mesa, Az) (text = Mesa, Az) and the selected is true or false. 

Here is the code

success: function (data) {
                         var select = $("#City");
                         select.empty();
                         $("#City").dropdownchecklist("destroy");
                         select.append("<option value='" + "" + "'>");
                         for (x in data) {
                             select.append("<option value ='" + data[x].value + "'>" + data[x].Value + "</option>")                      }

All the logic is code behind on which states are selected and cities if any. If 
I add an other option I can see the true or false for any city that is selected.

How do I use the data to also select the cities that are selected?

I attached the complete code of the view 

** What is your environment?
-- DropDownCheckList version: 1.4
-- jQuery version: jquery-1.6.1.min.js
-- jQuery UI version: jquery-ui-1.8.13.custom.min.js
-- Browser and version: ie 9

Original issue reported on code.google.com by ralf.a...@parishdata.com on 30 Aug 2011 at 9:26

Attachments:

GoogleCodeExporter commented 8 years ago
I got it to work, I just added a if selected add the selected and if false just 
add the item, and I put multiple on the select also I hope this may help 
someone.

Original comment by ralf.a...@parishdata.com on 31 Aug 2011 at 7:32

GoogleCodeExporter commented 8 years ago
I am glad you found your problem -- happy coding

Original comment by womohun...@ittrium.com on 6 Sep 2011 at 1:40