-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
usage of general jQueryUI Plugins #1
base: master
Are you sure you want to change the base?
Conversation
… using the "widget factory" utility from jQuery UI. Changes include: a possible uiNamespace setting on the ember view object. It makes it possible to use plugins that use other namespaces than the jQUeryUI native "ui" one. The "ui" namespace it default, so it's specification is not needed if only native jQUI Widgets are used -- The retrieval of the ui property of the mixin has been changed in order to be able to retrieve not only the native jQueryUI widget instances. Native ones are defined as properties on the jQuery UI object itself, which was previously used. Now the widget is first created on the jQuery-Object of the views DOM-Element, than the reference to the widget itself is created and saved like before.
var ui = jQuery.ui[this.get('uiType')](options, this.get('element')); | ||
|
||
|
||
var namespace = this.get('uiNamespace') || 'ui'; //the included jQuery UI widgets use the 'ui' namespace, ohter jQuery UI plugins may (or rather should) use their own namespace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't look like this variable is ever used. Is there something missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes.
var ui = jQuery(this.get('element')).data(namespace+"-"+this.get('uiType')) ;//save instance
..."namespace"+"-" in that line
Thanks @jdittrich. I would like to update this to support other jQuery plugins. I think this PR needs some work. Can you make some changes per my comments? |
…nal widgets; leftover debug message (console.log)
Thanks for your comments and apologies for some stupid stuff I oversaw. I fixed the code according to your comments. |
@jdittrich Thanks. That makes more sense. In order to make sure that I'm able to keep this working reliably as new versions of Ember and jQuery UI are released, it would be good to exercise the support you are adding. What do you think about adding a widget factory style plugin to the app so that people can see an example of this support in use, and we can more easily make sure it keeps working? |
absolutely – I was already thinking of that but I did not have a good idea what the widget should do. We could possibly reimplement a simple native widget, like button, which actually would enough for even demonstrating custom events – how is that? |
A custom button sounds like a decent choice. Happy to help with any of the Ember bits you need. |
Hi Luke, I implemented a very simple working example that demonstrates use of own jQueryUI namespaces and custom events. Reading through your code I tried to get to understand the {{collection}} helper in the template and noticed that it is deprecated: I tried to fix it but was not successful. (my attempt is inserted as comment in my master-branches index.html) |
Enable the use of jQueryUI Plugins that are created by the "widget factory" utility of jQUI (http://api.jqueryui.com/jQuery.widget/) Before, just the widgets that jQueryUI brings with it were supported.
Changes include: