This evening, I removed my references to JQuery 1.8.0 and reverted to 1.7.2. The error I received above is still present.
Tracing thru the JQM 1.2.0 Alpha 1 code, I find the following code is the only code in JQuery 1.7.2 or JQM 1.2.0 Alpha 1 that contains the substring "cannot call methods on " - the beginning of the error I'm getting.
- $.widget.bridge = function( name, object ) {
var fullName = object.prototype.widgetFullName;
$.fn[ name ] = function( options ) {
var isMethodCall = typeof options === "string",
args = slice.call( arguments, 1 ),
returnValue = this;
// allow multiple hashes to be passed on init
options = !isMethodCall && args.length ?
$.widget.extend.apply( null, [ options ].concat(args) ) :
options;
if ( isMethodCall ) {
this.each(function() {
var instance = $.data( this, fullName );
if ( !instance ) {
return $.error( "cannot call methods on " + name + " prior to initialization; " +
"attempted to call method '" + options + "'" ); // <-- Error thrown here
}
if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
return $.error( "no such method '" + options + "' for " + name + " widget instance" );
}
var methodValue = instance[ options ].apply( instance, args );
if ( methodValue !== instance && methodValue !== undefined ) {
returnValue = methodValue && methodValue.jquery ?
returnValue.pushStack( methodValue.get() ) :
methodValue;
return false;
}
});
} else {
this.each(function() {
var instance = $.data( this, fullName );
if ( instance ) {
instance.option( options || {} )._init();
} else {
new object( options, this );
}
});
}
return returnValue;
};
};
I've highlighted the line of code that appears to be throwing the error.
Going back to my code from my original post, it appears my call to $('#mainMenu').popup("open"); is the culprit.
Question: According to the popup documentation located at
here, I find the following text under the heading:
Calling the popup plugin
This plugin will autoinitialize on any page that contains a div with the attribute data-role="popup". However, if needed you can directly call the popup plugin on any selector, just like any jQuery plugin and programmatically work with the popup options, methods, and events API:
$('#myPopupDiv').popup();
The text continues to indicate I can call $('#myPopupDiv').popup("open"); to programatically "open" my popup.
Based upon the "error" I'm getting, it appears there is some kind of "initialization" necessary. But that seems to conflict with the documentation (unless I'm reading the documentation incorrectly.) The #mainMenu div in my code
is themed (see code in my first post) the way I wish it to be. If I'm understanding the "error", it appears I can't rely on the options in the <div> itself when I programatically call open(). Am I reading things incorrectly?
Robert