Permalink
Browse files

Table: Implement _setOptions() for style options

  • Loading branch information...
gabrielschulhof authored and arschmitz committed May 15, 2014
1 parent 22a6e22 commit d58937157b1c7b9c7eb6fa1676574758c33eb62c
Showing with 34 additions and 23 deletions.
  1. +34 −23 js/widgets/table.columntoggle.js
@@ -56,13 +56,6 @@ return $.widget( "mobile.table", $.mobile.table, {
return;
}
<<<<<<< HEAD
$.extend( this, {
_menu: null
} );
=======
>>>>>>> 1c6ea65... Table: Record UI elements both when pre-rendered and not
if ( this.options.enhanced ) {
id = this._id();
popup = $( this.document[ 0 ].getElementById( id + "-popup" ) );
@@ -84,14 +77,32 @@ return $.widget( "mobile.table", $.mobile.table, {
this._instantiating = false;
},
_themeClassFromOption: function( prefix, value ) {
return ( value ? ( value === "none" ? "" : prefix + value ) : "" );
},
_setOptions: function( options ) {
if ( options.disabled !== undefined && this.options.mode === "columntoggle" ) {
this._ui.popup.popup( "option", "disabled", options.disabled );
this._ui.button.toggleClass( "ui-state-disabled", options.disabled );
if( options.disabled ) {
this._ui.button.attr( "tabindex", -1 );
} else {
this._ui.button.removeAttr( "tabindex" );
if ( this.options.mode === "columntoggle" ) {
if ( options.disabled !== undefined ) {
this._ui.popup.popup( "option", "disabled", options.disabled );
this._ui.button.toggleClass( "ui-state-disabled", options.disabled );
if( options.disabled ) {
this._ui.button.attr( "tabindex", -1 );
} else {
this._ui.button.removeAttr( "tabindex" );
}
}
if ( options.columnBtnTheme !== undefined ) {
this._ui.button
.removeClass(
this._themeClassFromOption( "ui-btn-", this.options.columnBtnTheme ) )
.addClass( this._themeClassFromOption( "ui-btn-", options.columnBtnTheme ) );
}
if ( options.columnPopupTheme !== undefined ) {
this._ui.popup.popup( "option", "theme", options.columnPopupTheme );
}
if ( options.columnBtnText !== undefined ) {
this._ui.button.text( options.columnBtnText );
}
}
@@ -110,7 +121,7 @@ return $.widget( "mobile.table", $.mobile.table, {
this._on( this.window, {
throttledresize: "_setToggleState"
});
this._on( this._ui.menu, {
"change input": "_menuInputChange"
} );
@@ -190,21 +201,21 @@ return $.widget( "mobile.table", $.mobile.table, {
table = this.element,
opts = this.options,
ns = $.mobile.ns,
buttonTheme = this._themeClassFromOption( "ui-btn-", opts.columnBtnTheme ),
popupThemeAttr = opts.columnPopupTheme ?
( " data-" + $.mobile.ns + "theme='" + opts.columnPopupTheme + "'" ) : "",
fragment = this.document[ 0 ].createDocumentFragment();
id = this._id() + "-popup";
menuButton = $( "<a href='#" + id + "' " +
<<<<<<< HEAD
"class='" + opts.classes.columnBtn + " ui-button " +
"ui-button-" + ( opts.columnBtnTheme || "a" ) +
=======
"id='" + this._id() + "-button' " +
"class='" + opts.classes.columnBtn + " ui-btn " +
"ui-btn-" + ( opts.columnBtnTheme || "a" ) +
>>>>>>> 1c6ea65... Table: Record UI elements both when pre-rendered and not
" ui-corner-all ui-shadow ui-mini' " +
"class='ui-btn ui-corner-all ui-shadow ui-mini" +
( opts.classes.columnBtn ? " " + opts.classes.columnBtn : "" ) +
( buttonTheme ? " " + buttonTheme : "" ) + "' " +
"data-" + ns + "rel='popup'>" + opts.columnBtnText + "</a>" );
popup = $( "<div class='" + opts.classes.popup + "' id='" + id + "'></div>" );
popup = $( "<div class='" + opts.classes.popup + "' id='" + id + "'" +
popupThemeAttr + "></div>" );
menu = $( "<fieldset></fieldset>" ).controlgroup();
// set extension here, send "false" to trigger build/rebuild

0 comments on commit d589371

Please sign in to comment.