How to set the value form Materialize's Switches using jquery - materialize

I'm using the Materialize library and I'm trying to set the value for the switches . How to set the value for that ?

You can use the 'checked' property:
$('#yourswitch').prop('checked', false);

Related

what is [(selection)] in Angular 8?

Is it the same as [(ngModel)] ? Some kind of two-way binding ?
I do have the following tag on our project :
<p-table #tt [value]="universitiesList"[(selection)]="selectedUniversity" [globalFilterFields]="['Name']">
universitiesList and selectedUniversity are 2 variables which exist on the typescript of this component. I understand that. But are 'value' and 'selection' reserved words ? Why is value writen with [] and selection written within [()] ?
Ty a lot
[(selection)] is a property of a primeNG table
It is a form of two-way-binding
When a row / checkbox of the table is selected, the value is saved to that array
(the value is saved to the array"selectedUniversity") :
[(selection)]="selectedUniversity"
https://www.primefaces.org/primeng/v8.2.9-lts/#/table/selection :
<p-table [columns]="cols" [value]="cars" selectionMode="single" [(selection)]="selectedCar1" dataKey="vin">

PEGA SLIDER - and get refresh property

I got a requirement to do a slider in PEGA.
The issue is that I do not manage to get the field/property refreshed with the slider value. I need to use this property in a declare expression and in conditional visibility (layout).
I am looking for something like the autocomplete where the value is refresh without submitting.
Any idear will be welcome.
THX.
Ok, I have solved the issue. In order to actualise the property .Amount outside the layout, I needed to configure an action on the first layout. The one holding the slider. In this layout -> in actions : add an event: Change and Add an Action : Refresh-This section / Target Section.
The value is then dynamicly refreshed in the clipboard too.
PS : in order to have different step value inside the same slider (ex: from 0 to 10 step = 1, form 10 to 30 step = 3 ... ) just use a property in the Slider Parameters 'step' of the slider and link this property to a declare expression. Within the declare expression you can configure as much step as you want.

How to make a textbox readonly/editable in angular 2 based on some condition

I have a textbox, I want to make in readonly at some conditions and editable field in few conditions, So the field should toggle between read only/editable based on the condition , How to achieve this ?
You need to use the following (Angular 4):
<input [readonly]="isReadOnly">
If you use attr.readonly then the input will always be read-only because the readonly attribute will be present even if its value is false. By using [readonly] Angular will only place the attribute if isReadOnly is true.
After, you assign the value as you wish:
// when you want to be read-only
isReadOnly = true;
// whe you want to be editable
isReadOnly = false;
Use this: [readonly]="varInYourComponent" in your input field, on template.
And in your component declare and you should work with this variable:
boolean varInYourComponent
use property binding to achieve that
[property]="flag"

In Dojo how can we set a selected dropdown option?

i am using dropdown widget in dojo (dijit), i want to set the selected option the top menu
i tried this code:
dijit.byId('projectId').addOption({ label: item.projname , value: item.projid, selected:true });
here the selected: true
is not working
Thanks
The asker's code is not correct as the selected property applies for the construction of the object. As PaulR suggested, the asker should use dijit.byId('projectId').set("value",item.projid); when the select widget has already been created.
Aside: I would suggest using the AMD module "dijit/registry" rather than the root dijit object.
According to the documentation, "selected: true" is the correct way to specify the selected item. See https://dojotoolkit.org/reference-guide/1.9/dijit/form/Select.html.
I noticed the same issue in the past, and noticed that this only works correctly when an option has a value. So, can you check if "item.projid" contains a value?

Dojo attach point / byId returns undefined

I made a template and there is a <select dojotype="dijit.form.ComboBox" dojoAttachPoint="selectPageNumber" id="selectPageNumber">tag with id and dojoAttachPoint be "selectPageNumber". I want to populate it with options upon create so I add some code to the postCreate function:
var select = dijit.byId("selectPageNumber");
or
var select = this.selectPageNumber;
but I always have select being undefined.
What am I doing wrong?
UPD:
The problem with element has been solved spontaneously and I didn't got the solution. I used neither dojo.addOnLoad nor widgetsInTemplate : true, it just started to work. But I have found the same problem again: when I added another tag I can't get it!
HTML:
<select class="ctrl2" dojotype="dijit.form.ComboBox" dojoAttachPoint="selectPageNumber" id="selectPageNumber">
</select>
<select class="ctrl2" dojotype="dijit.form.ComboBox" dojoAttachPoint="selectPageNumber2" id="selectPageNumber2">
</select>
widget:
alert(this.selectPageNumber);
alert(this.selectPageNumber2);
first alert shows that this.selectPageNumber is a valid object and the this.selectPageNumber2 is null.
widgetsInTemplate is set to false.
all the code is within dojo.addOnLoad()
dojo.require() is valid
I am using IBM Rational Application Developer (if it is essential).
WHY it is so different?
Based on your syntax, I am assuming that you are using 1.6. Your question mentions template and postCreate, so i am assuming that you have created a widget that acts as a composite (widgets in the template).
Assuming 1.6, in your widget, have you set the widgetsInTemplate property to true. This will tell the parser that your template has widgets that need to be parsed when creating the widget.
http://dojotoolkit.org/documentation/tutorials/1.6/templated/
I would remove the id from the select. Having the id means that you can only instantiate your widget once per page. You should use this.selectPageNumber within your widget to access the select widget.
If you are using 1.7 or greater, instead of setting the widgets widgetsInTemplate property, you should use the dijit._WidgetsInTemplateMixin mixin.
http://dojotoolkit.org/reference-guide/1.8/dijit/_WidgetsInTemplateMixin.html
Depending on when dijit.byId() is being called, the widget may not have been created yet. Try using dojo.addOnLoad()
dojo.addOnLoad(function() {
var select = dijit.byId("selectPageNumber");
});
I came close to the solution: it seems like there is a some sort of RAD "caching" that doesn't respond to changes made in html code.
Ways to purge the workspace environment with RAD (based on Eclipse) might be a solution.