Thanks Danny, The widget factory will be getting much love for 1.7. I'll be in touch with you when I'm working on it.
On Jan 12, 2:36 pm, Danny <[email protected]> wrote: > Ticket created,http://ui.jquery.com/bugs/ticket/3803 > Danny > > On Jan 12, 7:59 am, Scott González <[email protected]> wrote: > > > Jay, thanks for creating the test case, and thanks Danny for beating > > me to a response :-) > > > Danny's response is fully correct and in fact while I was looking at > > your example, I was thinking about how we would support this natively > > and came to pretty much the same conclusion as Danny. If one of you > > wants to create a feature request in Trac > > (http://ui.jquery.com/bugs/newticket > > ), we'll try to get this in for 1.7. > > > On Jan 10, 10:44 pm, Danny <[email protected]> wrote: > > > > The last post was mangled; I wanted to say you could use a custom > > > event: > > > $.fn.cloneTheWidgets = function (){ > > > return this.clone() // don't clone events > > > .each(function(){ > > > var handlers = $.data(this,'events')['cloneTheWidgets']; > > > if (handlers) for (var handler in handlers) handlers > > > [handler].apply(this); // manually trigger the clone event handlers > > > } > > > > }; > > > > and in the widget init function: > > > > init: function(){ > > > var self = this; > > > self.element.bind('cloneTheWidgets', function() {$(this) > > > [self.widgetName](self.options)}); > > > ...the rest of your init > > > > } > > > > Though I haven't tested this. > > > > Danny > > > > On Jan 9, 5:01 pm, jayg <[email protected]> wrote: > > > > > Scott, sorry for the delayed response, had to come up with a stripped > > > > down test page and find somewhere to put it. I have used for my > > > > example, I used the superbox > > > > onhttp://youngisrael-stl.org/wordpress/2008/08/22/extending-jquery-ui-w... > > > > The example page can be found > > > > here:http://sarahhealydesign.com/widget_test.html > > > > > What I am trying to do seems like it should be simple, and perhaps I > > > > am missing something obvious. Basically all I do is attach a click to > > > > the button, and do: > > > > $('#experiment1') > > > > .clone(true) > > > > .appendTo('body') > > > > .attr('id','experiment2'); > > > > > I attached an alert to the superbox, so whenever you click it, it > > > > tells you what it thinks is its id with this.element.get(0).id > > > > > You will see in the example that it always returns experiment1 for the > > > > id. Any help is much appeciated! > > > > > -j > > > > > On Jan 8, 11:20 am, Scott González <[email protected]> wrote: > > > > > > Can you provide a demo page showing your problem? > > > > > > On Jan 7, 10:20 pm, jayg <[email protected]> wrote: > > > > > > > I have a custom widget built on jquery UI that I am running into an > > > > > > odd issue with. Everything works as I want on initial use, but > > > > > > when I > > > > > > do a clone(true) on the widget and append it to another element, the > > > > > > cloned version does not seem to have a proper handle on where it > > > > > > lives > > > > > > in the dom - it returns the old id upon calling this.element.get > > > > > > (0).id. Do I need to do something, maybe call some method, to > > > > > > update > > > > > > this information w/in the widget, or is this only ever set upon > > > > > > initial creation? I did try calling $('#myItem').myWidget('init'), > > > > > > but no dice. Any thoughts? Something obvious I am missing? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery UI" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en -~----------~----~----~----~------~----~------~--~---
