jQuery Plugins » widget https://jqueryplugins.info jQuery plugins, tutorials and resources Thu, 20 Oct 2011 05:14:02 +0000 en hourly 1 http://wordpress.org/?v=3.2.1 How to access instance properties of jQuery widget within Backbone.js classes? https://jqueryplugins.info/2011/10/how-to-access-instance-properties-of-jquery-widget-within-backbone-js-classes/ https://jqueryplugins.info/2011/10/how-to-access-instance-properties-of-jquery-widget-within-backbone-js-classes/#comments Wed, 12 Oct 2011 12:15:41 +0000 Admin https://jqueryplugins.info/2011/10/how-to-access-instance-properties-of-jquery-widget-within-backbone-js-classes/ Post link: How to access instance properties of jQuery widget within Backbone.js classes?

I’m working on a jQuery widget that internally uses Backbone.js. Here the collection creates the models, the view creates its own subviews: Serializer = function(options, element){ this.element = element; this.data...

]]>
Post link: How to access instance properties of jQuery widget within Backbone.js classes?

I’m working on a jQuery widget that internally uses Backbone.js.
Here the collection creates the models, the view creates its own subviews:

Serializer = function(options, element){
  this.element = element;
  this.data = options.data;
  this.collection = new Serialize.Collection(this.data);
  this.view = new Serialize.View({ el: this.element, collection: this.collection });
};

$  .widget.bridge("serialize", Serializer);

$ .widget.bridge provides a friendly wrapper for creating instances of the widget and passing in options (here the @vars are set by Rails):

$  ('#item').serialize({
   data: <%= @data %>,
   name: '<%= @name %>',
   keys: '<%= @keys %>'
 });

The models and views created later need access to the options of the widget instance. I solved this so far by setting the options on the collection itself:

this.collection = new Serialize.Collection(this.data, options);

And referencing them later where they are needed (e.g. in a view):

var keys = this.model.collection.keys

But this gets messy and is not that flexible.

For a single instance you could set Serialize.Config = { // options }, and access it globally. But for multiple instances, each instance needs its own config.

So my question is, is there a clean way to access the widget instance and its options within the Backbone classes, without passing it as an argument?

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/10/how-to-access-instance-properties-of-jquery-widget-within-backbone-js-classes/feed/ 0
Star Rating widget for jQuery UI + ui-crystal-star https://jqueryplugins.info/2011/09/star-rating-widget-for-jquery-ui-ui-crystal-star/ https://jqueryplugins.info/2011/09/star-rating-widget-for-jquery-ui-ui-crystal-star/#comments Tue, 13 Sep 2011 09:14:20 +0000 Admin https://jqueryplugins.info/2011/09/star-rating-widget-for-jquery-ui-ui-crystal-star/ Post link: Star Rating widget for jQuery UI + ui-crystal-star

I want my rating star design to appear as the following (ui-crystal-star): I’m able to get the following works: However, I want the design of ui-crystal-star but haven’t been able...

]]>
Post link: Star Rating widget for jQuery UI + ui-crystal-star

I want my rating star design to appear as the following (ui-crystal-star):

enter image description here

I’m able to get the following works:

enter image description here

However, I want the design of ui-crystal-star but haven’t been able to find clear example how to transform those to ui-crsytal-star. Can anyone please point me to the correct direction of making this to work in ui-crsytal-star or put a quick code snippet ?

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/09/star-rating-widget-for-jquery-ui-ui-crystal-star/feed/ 0
trigger help, and how to inherit global objects (jQuery Ui widget) https://jqueryplugins.info/2011/08/trigger-help-and-how-to-inherit-global-objects-jquery-ui-widget/ https://jqueryplugins.info/2011/08/trigger-help-and-how-to-inherit-global-objects-jquery-ui-widget/#comments Wed, 31 Aug 2011 07:14:01 +0000 Admin https://jqueryplugins.info/2011/08/trigger-help-and-how-to-inherit-global-objects-jquery-ui-widget/ Post link: trigger help, and how to inherit global objects (jQuery Ui widget)

Hello Stackoverflow users, I have a question regarding an JQ UI widget im trying to make. I have a _create command with the following: this.findinput = this.element.children('input:text') .addClass('ui-search-input ui-widget ui-state-default...

]]>
Post link: trigger help, and how to inherit global objects (jQuery Ui widget)

Hello Stackoverflow users,

I have a question regarding an JQ UI widget im trying to make.
I have a _create command with the following:

    this.findinput =    this.element.children('input:text')
                            .addClass('ui-search-input ui-widget ui-state-default ui-background-none ui-corner-left')
                            .wrap('<div class="ui-position-wrapper" />')
                            .bind('focusin focusout',this._checkval)
                            .bind('keyup',this.inputchanged);

As you can see i bind some function to the input field, so i can manipulate the text and layout.
But my problem is that the function is for some reason overwriting the globa object ‘this’ and its variables.
How can i keep them inside the functions?
(The reason i use functions is so i can acces them from outside the widget)

inputchanged: function(e) {
    $  target = $  (e.target);
    if (($  target.val()).length != 0) {
        this.element.children('.ui-search-reset').children().addClass('ui-icon').removeClass('ui-helper-hidden');
    } else {
        this.element.children('.ui-search-reset').children().addClass('ui-helper-hidden').removeClass('ui-icon');
    }
},

returns: this.element is undefined and i cant acces this.options either?

Also if i bind a function to a “tr” in a table, and press the “td” it sets the “td” as the target object instead of the “tr”, which where the one binded – why is this? :)

Im quite new to jQuery so this might be stupid questions, or i might be doing it wrong – please let me know if that is the case!

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/08/trigger-help-and-how-to-inherit-global-objects-jquery-ui-widget/feed/ 0
Stop ‘enter’ key submitting form when using jquery ui autocomplete widget https://jqueryplugins.info/2011/08/stop-enter-key-submitting-form-when-using-jquery-ui-autocomplete-widget/ https://jqueryplugins.info/2011/08/stop-enter-key-submitting-form-when-using-jquery-ui-autocomplete-widget/#comments Tue, 30 Aug 2011 00:13:16 +0000 Admin https://jqueryplugins.info/2011/08/stop-enter-key-submitting-form-when-using-jquery-ui-autocomplete-widget/ Post link: Stop ‘enter’ key submitting form when using jquery ui autocomplete widget

I’ve got a form that uses the jquery autocomplete UI plugin, http://jqueryui.com/demos/autocomplete/, which all works sweet except when you press the enter key to select an item in the autocomplete...

]]>
Post link: Stop ‘enter’ key submitting form when using jquery ui autocomplete widget

I’ve got a form that uses the jquery autocomplete UI plugin, http://jqueryui.com/demos/autocomplete/, which all works sweet except when you press the enter key to select an item in the autocomplete list, it submits the form.

I’m using this in a .NET webforms site, so there may be javascript handling associated with the form that .NET is injecting that is overriding the jQuery stuff (I’m speculating here).

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/08/stop-enter-key-submitting-form-when-using-jquery-ui-autocomplete-widget/feed/ 0
Demo widget jQuery https://jqueryplugins.info/2011/08/demo-widget-jquery/ https://jqueryplugins.info/2011/08/demo-widget-jquery/#comments Thu, 25 Aug 2011 05:05:24 +0000 Admin https://jqueryplugins.info/2011/08/demo-widget-jquery/ Post link: Demo widget jQuery

Esempio utilizzo widget jQuery Video Rating: 0 / 5

]]>
Post link: Demo widget jQuery

Esempio utilizzo widget jQuery
Video Rating: 0 / 5

]]>
https://jqueryplugins.info/2011/08/demo-widget-jquery/feed/ 0
jQuery UI selectable widget https://jqueryplugins.info/2011/08/jquery-ui-selectable-widget/ https://jqueryplugins.info/2011/08/jquery-ui-selectable-widget/#comments Thu, 18 Aug 2011 18:37:14 +0000 Admin https://jqueryplugins.info/2011/08/jquery-ui-selectable-widget/ Post link: jQuery UI selectable widget

My setup: jQuery 1.6.2, jQuery UI 1.8.15 I got the selectable interaction to work but unfortunately I have links in the element itself that need to be clickable. Right now,...

]]>
Post link: jQuery UI selectable widget

My setup: jQuery 1.6.2, jQuery UI 1.8.15

I got the selectable interaction to work but unfortunately I have links in the element itself that need to be clickable. Right now, it’s not possible to do that selectable interaction, does anyone know if there is a workaround?

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/08/jquery-ui-selectable-widget/feed/ 0