SAPUI5 JSONModel cant be updated in controler - combobox

i have 2 Comboboxes on my view.xml. If one changes his content, the other should apear.
<ComboBox id="cb1_ort_anla" width="100%" selectionChange="selChange" value="{/item/value1}" selectedKey="1">
..
</ComboBox>
<ComboBox id="cb2_oa" width="100%" selectionChange="onChange" value="{/item/value2}" selectedKey="1" visible="{/visibility_loc_sub}">
</ComboBox>
In the controler, i am defining a model with the properties from above:
onInit : function (){
this.oModel = new JSONModel(
{ "visibility_loc_sub" : false,
"visibility_asset" : true,
"item":{
"value1":"",
"value2":"",
"value3":""
}
});
this.getView().setModel(this.oModel);
}
the methode selChange should change the property "visibility_loc_sub" to true with this code:
selChange : function(oEvent){
this.oModel.setProperty("visibility_loc_sub", true);
this.getView().setModel(this.oModel);
} <--
In the debugger the property visibility_loc_sub at this(<--) point is still false. "this.oModel.visibility_loc_sub= true;" is not working either.
Am i doing something wrong? And if yes, what should i do?
thanks for your help!

Related

How to OneWayBind to materialDesign:ButtonProgressAssist.IsIndicatorVisible DependencyProperty

I have a login button that I would like to apply an indeterminate progress look to while the login process is happening.
Here is the XAML for the button:
<Button x:Name="LoginButton" Style="{StaticResource MaterialDesignRaisedButton}"
materialDesign:ButtonProgressAssist.Value="-1"
materialDesign:ButtonProgressAssist.IsIndicatorVisible="false"
materialDesign:ButtonProgressAssist.IsIndeterminate="true">
LOGIN
</Button>
So I figure I can just bind a boolean property on my view model to materialDesign:ButtonProgressAssist.IsIndicatorVisible. I'm using code behind binding like so:
public partial class Connection : ReactiveUserControl<ConnectionViewModel>
{
public Connection()
{
InitializeComponent();
ViewModel = ViewModelLocator.ConnectionViewModel;
this.WhenActivated(d =>
{
this.BindCommand(ViewModel, vm => vm.LoginCommand, v => v.LoginButton).DisposeWith(d);
// How do I bind to this property using OneWayBind?
this.OneWayBind(ViewModel, vm => vm.LoggingIn, v => v.LoginButton.ButtonProgressAssist.IsIndicatorVisible).DisposeWith(d);
});
}
}
Intellisense doesn't pick up on that material designs dependency property. How do I reference it?
In case it matters, the WPF project targets .NET Core 3.1
I don't think the OneWayBind method supports attached properties but you could bind to it in the XAML markup:
materialDesign:ButtonProgressAssist.IsIndicatorVisible="{Binding LoggingIn, Mode=OneWay}"
You can of course do OneWayBind for the other properties just like before.

isSelected returns false and isChecked shows compilation error

let checkBoxXpath = accessPolicyPage.listCheckBoxXpathS + i + accessPolicyPage.listCheckBoxXpathE;
//element(by.xpath(checkBoxXpath)).click();
expect(element(by.xpath(checkBoxXpath)).isSelected()).toBeTruthy();
in the above code isSelected returns false and if I replace it by isChecked, it shows error as "property 'ischecked' not found on ElementFinder"
How I can overcome this
There is nothing called isChecked in Protractor. You can do this by using isSelected.
webdriver.WebElement.prototype.isSelected = function() {
return this.schedule_(
new webdriver.Command(webdriver.CommandName.IS_ELEMENT_SELECTED),
'WebElement.isSelected()');
};
Refer this to more information. Hope this helps. :)

reload and render combobox

I work with extjs 3.4
I have a problem when I try to assign defaut value in combobox
this is my code :
<form:combobox property="from_tr"
displayField="fullname" valueField="id"
allowBlank="true" editable="true" forceSelection="true"
pageSize="10" hideTrigger="true" width="400"
fields="address" lang="<%=lang%>"
tpl='<tpl for="."><div class="x-combo-list-item"><b>{fullname}</b><br>{address}</div></tpl>'
dataStore="com.testStore" autoLoad="false" />
in onready function I make this code :
Ext.onReady(function() {
Ext.QuickTips.init();
var idAdr='AB-20';
var store = from_tr_myPage.getStore();
store.load({
callback: function() {
from_tr_myPage.setValue(idAdr);
}
});
});
but after test I have this value AB-20 in combobox
in the combobox I want to show the fullname
I try without success to render and reload the combobox
First of all, if you try to html with extjs component, it will unnecessary
complex. Why don't you use the combobox component which sencha is providing.
I suggest to use inbuilt component as much as possible.
Try something like that:
var index = store.find("id", idAdr);
var recordSelected = store.getAt(index);
from_tr_myPage.setValue(recordSelected.get('fullname'));
Hope this helps.

How to select all checkBoxes in LongListMultiSelector WP8

How can i select all the checkBoxes in LongListMultiSelector on click of a ApplicatonBar's ApplicationBarMenuItem. This feature is same as messaging app of wondows phone.
I reffered
Click here
but no use.
my code:
<toolkit:LongListMultiSelector x:Name="requestList"
EnforceIsSelectionEnabled="False">
<toolkit:LongListMultiSelector.ItemTemplate>
<DataTemplate>
<TextBlock x:Name="requestNameTxtblk"
Text="{Binding request}"
TextWrapping="Wrap" HorizontalAlignment="Left"
Width="268" Height="66" FontSize="25"/>
</DataTemplate>
</toolkit:LongListMultiSelector.ItemTemplate>
</toolkit:LongListMultiSelector>
Thanks
Can you just iterate over the requestList's ItemsSource and mark the items as selected:
(note this code is not tested, just a guess for now):
foreach (var item in requestList.ItemsSource)
{
item.Selected = true;
}
Or similar?
Hi guys got the solution
foreach (var item in requestList.ItemsSource)
{
requestList.SelectedItems.Add(item);
}
this will check all the checkBox in the list and to uncheck all the box
Remove() method can be used as add()

ExtJs - how correctly implement the code as an event

I have code:
...
function Edit(id) { ... }
...
view : new Ext.grid.GroupingView({
groupTextTpl : '... link...'
...
Everything works, but it would be something on the similarity:
...
Ext.get('edit').on('click', function() {
alert(this.getValue());
});
...
view : new Ext.grid.GroupingView({
groupTextTpl : '... link...'
...
But for some reason does not work, error - Ext.get ("edit") is null.
What am I doing wrong?
Ext.get('edit') gets called before it is created, hence the error. Put the Ext.get() below the GroupingView()

Resources