I have an ion-select which can select multiple options and i am setting the first option as selected initially using below code:
<ion-select interface="popover" class="note-select-list-documents"
[(ngModel)]="macroValues[ind]"
[multiple]="question.IsMultiSelect">
<ion-option *ngFor="let option of question.PickListOptions; let i = index"
[selected]="i==0"
[value]="option">{{option}}
</ion-option>
</ion-select>
Now, initially one option will remain selected but user can deselect that options. But, i want that there will always be one item selected. If user have option selected, then user can deselect one but when one item is selected, user can not deselect it.
Is there any control on ion-select to achieve this scenario?
Related
So I want to create a modal-like behavior for the search.
When the ion-searchbar is focused, a modal would slide from the bottom showing search history, which would hold the suggestion once the user starts typing. The problem with ionic nodals is the backdrop, I couldn't keep the ion-searchbar active to input search words.
This component is called Popover, you can create them pretty much like you do with a modal but using an PopoverController instead. The PopoverController.create() method has an event parameter that will tell which element will be the anchor for the popover, set that to your search bar and it should be magically aligned.
By default a backdrop is shown when the popover is created but it can be deactivated via showBackdrop property upon creation.
Take a look at the Ionic's Popover API Docs for further information
I ended up by using segments, as below:
<div *ngIf="segment == 'prodSection'">
...
</div>
<div *ngIf="segment == 'searchSection'">
...
</div>
I styled the two divs in a way to be on top of each other and added events to the searchbar like:
<ion-searchbar (ionFocus)="openSearch()" (ionCancel)="retProd()"></ion-searchbar>
And toggeled between the segments with setting the segment variable's value with each event.
I have a dropdown in my app like this.
at beginning i am showing "Choose Filters" as the dropdown hint, once any of the item in dropdown in selected and there is a button as + icon once pressed I am doing further operations.
If an option is selected in dropdown its visible in the app, what I want to do is after selecting an option if clicks on that + icon I want instead of that selected dropdown value display the hint i.e "Choose Filters" . Is there any way to that please let me know.Thanks!
If you want the DropdownButton to show the hint again, you need to set it's selected value to null. So the variable you are setting on the property value of the DropdownButton should be set to null.
I have a drop down control with first item as blank. But usually when the user will land on the page, there will be a value selected. User can click on the arrow in combobox to open the list and then choose the first option which is blank to clear the value. Issue is the list of options is too long and as the control always focusses/takes user to the option that was selected key, the user has to do some scrolling to reach the first option of blank.
Is there a way to always redirect the user to the blank option rather than the selected key option?
view.xml
<Label text="Reason"/>
<ComboBox items="{path:'modelName'>/results'}">
<items>
<core:Item text="{modelName>description}" key="{modelName>code}"/>
</items>
</ComboBox>
Inside my Ionic application, Let's say I have an ion-list with some ion-items inside like this:
<ion-list>
<ion-item>
I love kittens!
<ion-option-button class="button-positive">Share</ion-option-button>
<ion-option-button class="button-assertive">Edit</ion-option-button>
</ion-item>
// Some other items in the list
</ion-list>
I want to programmatically (e.g click of a button), open up the option menu on all the items. Same effect as if the user has swiped all the items to the left simultaneously.
I was not able to find any documentation on this. How can I achieve that?
I know it's pretty late but it's for someone who wants to do that same.
This not an actual solution but a direction to get it done.
You need to find out the call ionic gives on left/right swipe of item and just call that method from your code(off course after adding required dependencies).
I know I can use close-others to make sure no more than one group is open, but I want to make sure exactly one group is open. That is, I want to prevent the user from being able to close the ope group.
Is there a way to do it?
It seems not possible to do it with the accordion. What I ended up doing is replacing the accordion with a list of collapse items that has ng-click that set the current selected item, and unselect the previously selected item.