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
Hi!
I just stumbled upon the following: For a lot of (maybe all) components the documentation mentions the method toggleState() as a way "to interact with the input component" and gives i.e. the following example:
var checkbox = $(el).data('checkbox');
checkbox.toggleState();
if you look at the code you see for example in checkbox.js:
At first I thought this was a simple line switch, but then I realized that this function is called by changeAttribute() in order to update the css classes when the element is disabled by the user. This means:
// works fine:
var el = $("#checkboxid");
el.prop( "disabled", !el.prop( "disabled" ) );
// makes no sense the way the code is written:
var checkbox = el.data('checkbox');
checkbox.toggleState();
Maybe I am misunderstanding somthing, but I believe contrary to what the documentation says enable(), disable() and toggleState() cannot be used "to interact with the input component", because they only make sense as internal functions.
In the case of checkbox the method indeterminate() also does not work, because it only changes the internal indeterminate option, but not the data-indeterminate attribute of the element.
The text was updated successfully, but these errors were encountered:
Checkbox: add API method toggle( state ). The state must be -1 (indeterminate), 0 (unchecked), 1 (checked) or undefined (toggle between checked and unchecked)
Hi!
I just stumbled upon the following: For a lot of (maybe all) components the documentation mentions the method toggleState() as a way "to interact with the input component" and gives i.e. the following example:
if you look at the code you see for example in checkbox.js:
At first I thought this was a simple line switch, but then I realized that this function is called by changeAttribute() in order to update the css classes when the element is disabled by the user. This means:
Maybe I am misunderstanding somthing, but I believe contrary to what the documentation says enable(), disable() and toggleState() cannot be used "to interact with the input component", because they only make sense as internal functions.
In the case of checkbox the method indeterminate() also does not work, because it only changes the internal indeterminate option, but not the data-indeterminate attribute of the element.
The text was updated successfully, but these errors were encountered: