You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.
Problem: there is no unique way to tell what a widget is from a js routine.
Context: when writing generic modules to, for example reset each widget to a default value writing a generic routine is fairly difficult and not consistent as each widget has a different way of being changed and refreshed on screen. (this could also streamline form validations, reset, display of data etc ...)
for example refreshing a select element is different whether the widget is a slider or a select menu.
// exerpt form a form display refresh routine
....
// this is weird for a flip-switch
$('select.ui-slider-switch', pageid).slider('refresh');
// this is for a 'normal' select
$('select', pageid).not('.ui-slider-switch').selectmenu('refresh');
...
checking for .ui-slider-switch is too close to jqm and may fail in a future release if some css changes.
So I suggest to populate a new "data-widget-is" value indicating which widget has been created when jqm enhances the markup. in my example "widget-is" would be equal to either flipswitch or selectmenu, or maybe expand the use of data-role
benefit: this would make interacting with jqm widgets easier, more consistent and less reliant on some specific markup, subject to change in a future release.
The text was updated successfully, but these errors were encountered:
I am closing this as a feature request. However, I wonder what would be the difference between the data- attribute that you suggest and data-role. You can also set an ID for the native element and use it as selector.
Problem: there is no unique way to tell what a widget is from a js routine.
Context: when writing generic modules to, for example reset each widget to a default value writing a generic routine is fairly difficult and not consistent as each widget has a different way of being changed and refreshed on screen. (this could also streamline form validations, reset, display of data etc ...)
for example refreshing a select element is different whether the widget is a slider or a select menu.
// exerpt form a form display refresh routine
....
// this is weird for a flip-switch
$('select.ui-slider-switch', pageid).slider('refresh');
// this is for a 'normal' select
$('select', pageid).not('.ui-slider-switch').selectmenu('refresh');
...
checking for .ui-slider-switch is too close to jqm and may fail in a future release if some css changes.
So I suggest to populate a new "data-widget-is" value indicating which widget has been created when jqm enhances the markup. in my example "widget-is" would be equal to either flipswitch or selectmenu, or maybe expand the use of data-role
benefit: this would make interacting with jqm widgets easier, more consistent and less reliant on some specific markup, subject to change in a future release.
The text was updated successfully, but these errors were encountered: