Common initialization / common variables in jQuery UI Widget factory?

Common initialization / common variables in jQuery UI Widget factory?

I have a jQuery UI plugin that is working successfully. I want to convert it to jQuery UI Widget Factory. My current widget allows me to apply one initialization across all of the selected elements.

I do this just before my this.each statement. Works great.

I call my current plugin like this:

 $("input[title *= 'Cost Center Name']").simpleDialogListSP({spListName : "Cost Centers", dialogTitle : "Cost Centers" }); 

I have multiple input boxes with the title of Cost Center Name X. My plugin goes out and grabs a list of values that are used across all of the selected input boxes.


Now I am trying to do the same thing in Widget Factory but the only function I can find is _create which gets called for each selected element. Is there any way to have one common initialization function in Widget factory across all of the selected elements? Also to have variables that are common to all of the elements as a group?

Is there something I am doing wrong?  Should _Create be called just once per selected group of elements or once per selected element?   A sample tutorial that I found online seems to suggest it should be called just once.


Hopefully I have explained this correctly.

P.S. I do not want to have to pass the list as an option. I want things to be as simple as possible for the end user programmer. The current plugin makes an API call to SharePoint. I rather that complexity remain with the plugin.