cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Changing Button on the basis of selection in select view

manojpandey
13-Aquamarine

Changing Button on the basis of selection in select view

Actually I want to place some buttons at the bottom of screen and I want that when i choose 'suspension assembly' some specific buttons should be displayed and when I choose other option such as 'arm assembly' some other buttons  should be displayed and the previous one should hide.

 

Also when i switch window, operation done by the previous button should be disabled.

I am not from coding background so it will be of great help if anyone can provide code for it.

ACCEPTED SOLUTION

Accepted Solutions

Hi @manojpandey ,

 

I think to work your project you need to correct your code to:

...
$scope.my_json = [
{
display: "Suspension Assembly",
value: "app/resources/Uploaded/Suspension_Low.pvz"
},
{
display: "Arm Assembly",
value: "app/resources/Uploaded/Arm_Assembly_Low.pvz"
},
{
display: "Front Hub Assembly",
value: "app/resources/Uploaded/Front_Hub_Low.pvz"
}

];

...
$scope.$on('$ionicView.afterEnter', function() {$scope.populateModelList();}); $scope.checkSequence = function(){ var sequenceValue= $scope.app.view['Home'].wdg['select-1']['value']; var sequenceList = $scope.app.view['Home'].wdg['select-1']['list']; for (i = 0; i < sequenceList.length; i++){ var sequence = sequenceList[i]['value']; if (sequence == sequenceValue){ switch(i){ case 0: $scope.setWidgetProp('3DLabel-1','visible', true); $scope.setWidgetProp('3DImage-1','visible', false); $scope.setWidgetProp('3DImage-2','visible', false); break; case 1: $scope.setWidgetProp('3DImage-1','visible', true); $scope.setWidgetProp('3DLabel-1','visible', false); $scope.setWidgetProp('3DImage-2','visible', false); break; case 2: $scope.setWidgetProp('3DImage-2','visible', true); $scope.setWidgetProp('3DLabel-1','visible', false); $scope.setWidgetProp('3DImage-1','visible', false); break; default: console.log('in show/hide images'); } } } }

So in the Json  definiton used for the list was the key  'value' but you used 'val' instead which was not correct

View solution in original post

2 REPLIES 2

Hi @manojpandey ,

 

I think to work your project you need to correct your code to:

...
$scope.my_json = [
{
display: "Suspension Assembly",
value: "app/resources/Uploaded/Suspension_Low.pvz"
},
{
display: "Arm Assembly",
value: "app/resources/Uploaded/Arm_Assembly_Low.pvz"
},
{
display: "Front Hub Assembly",
value: "app/resources/Uploaded/Front_Hub_Low.pvz"
}

];

...
$scope.$on('$ionicView.afterEnter', function() {$scope.populateModelList();}); $scope.checkSequence = function(){ var sequenceValue= $scope.app.view['Home'].wdg['select-1']['value']; var sequenceList = $scope.app.view['Home'].wdg['select-1']['list']; for (i = 0; i < sequenceList.length; i++){ var sequence = sequenceList[i]['value']; if (sequence == sequenceValue){ switch(i){ case 0: $scope.setWidgetProp('3DLabel-1','visible', true); $scope.setWidgetProp('3DImage-1','visible', false); $scope.setWidgetProp('3DImage-2','visible', false); break; case 1: $scope.setWidgetProp('3DImage-1','visible', true); $scope.setWidgetProp('3DLabel-1','visible', false); $scope.setWidgetProp('3DImage-2','visible', false); break; case 2: $scope.setWidgetProp('3DImage-2','visible', true); $scope.setWidgetProp('3DLabel-1','visible', false); $scope.setWidgetProp('3DImage-1','visible', false); break; default: console.log('in show/hide images'); } } } }

So in the Json  definiton used for the list was the key  'value' but you used 'val' instead which was not correct

Thanks man!!

This is what i needed

Announcements

Top Tags