2

I am using jQuery clone to clone parts of a form and restore to their original state (saved in the clone) if the user decides to "cancel".

My clone code looks like this:

$(filterSec).find("select option:selected").attr("selected", true); // clone doesn't save user selections
savedFilterSec = filterSec.clone(true);

And the code to restore:

$('.openFilter').replaceWith(savedFilterSec);

This works for most of my form. The problem is that I have some jqxListBoxes that are restored to their original state when the user cancels, but no longer work - I can no longer select anything (or drag and drop, which I set up using jqxdragdrop). Is there some functionality that is not being cloned? How can I reactivate the list boxes after the "rollback"?

Edit:

This seems to be a problem with all jqxWidgets, not just the list box.

froadie
  • 79,995
  • 75
  • 166
  • 235
  • 1
    Do these `jqxListBoxes` have events bound to them? I'm guessing they do. Events bound to DOM elements are not carried over when using jQuery `.clone()` - http://api.jquery.com/clone/ – matthewpavkov Jan 27 '13 at 21:40
  • Perhaps you need to call the constructor on the relevant elements again, after you restore the code? `$('.jqxListBoxClass').jqxListBox({...});` – matthewpavkov Jan 30 '13 at 19:49
  • @matthewpavkov - I tried that and it didn't help. I also tried calling `endUpdate` and `refresh`... – froadie Jan 30 '13 at 20:28

0 Answers0