My widget function isn't getting overridden by the options I pass in. What am I doing wrong?
And PS: Do you think my Base Framework should be a widget
at all? Or am I just trying to force my design to meet the JQuery UI
design? Any recommendations of how I should change it?
(function ($) { /*
Design Widget
*/ $.widget( "MY_NAMESPACE.design", {
_create: function () {
if (!this.options.framework) this.options.framework = $('<div></div>') .appendTo($('body')) .baseFramework();
this._super( "_create" ); },
addRow: function() {
var framework = this.options.framework;
// Why do I need to say framework.baseFramework // Why cant I just do framework.addRow(); ?? // Is it possible to do this? var row = framework.baseFramework('addRow');
row.appendTo(this.element); } });
/*
Framework Widget
Framework could be Bootstrap twitter, WordPress, other
I’ve never considered passing in a function as an option to instantiate a widget and then have it become a method. I don’t think you should. And I don’t think you can make it into a method.
You could pass a function that you call inside a defined method.
JΛ̊KE
Leave a comment on jakecigar's reply
Change topic type
Link this topic
Provide the permalink of a topic that is related to this topic