Dear Sir/Mdm/Ms:
If i want to use both html select and igx-simple-combo (which behaves like auto-complete) and autocomplete (https://pt-br.infragistics.com/products/ignite-ui-angular/angular/components/autocomplete) side-by-side, how to style both igx-simple-combo, autocomplete to basic look-and-feel of html select from previous example here:
https://stackblitz.com/edit/xusebhfz-n7f4xj4n?file=src%2Fapp%2Fgrid%2Fgrid-sample-right-pinning%2Fgrid-right-pinning.component.html
was resorted to do something like this to make it works:
<igx-simple-combo [id]="getXXXId(cell)" [data]="XXXlist" [class]="'my-simple-combo2'" (selectionChanging)="XXXChanging($event, cell)" placeholder="Select XXX" [ngModel]="getXXXFromCell(cell).XXXName_YYY_ZZZ" [valueKey]="'XXXName_YYY_ZZZ'" [displayKey]="'XXXName'"> <ng-template igxComboClearIcon></ng-template> </igx-simple-combo>
:host ::ng-deep .igx-input-group--box .igx-input-group__bundle{ height: 25px !important; } :host ::ng-deep igx-input-group > div.igx-input-group__wrapper > div{ background-color: white; } :host ::ng-deep igx-input-group > div.igx-input-group__wrapper > div > div.igx-input-group__bundle-end > igx-suffix.igx-combo__toggle-button{ background-color: white; } :host ::ng-deep .igx-input-group__notch:empty+.igx-input-group__bundle-main .igx-input-group__input { height: 25px !important; }
Any better way?
Thanks in advance.
Hello:
Thanks for the help.
What i've gotten here is: dropdown appears on a whole-page overlay, but not adjacent/right-below to the input, after applying your code.
May i have the stackblitz.com of what you have done, or it's the best effort that can be done thru Infragistics' overlay service?
Hello,
I have been looking into your additional question, and what I can suggest is passing the input group and dropdown as parameters to the iconClick method. Then, inside the method, you should use the dropdown’s open/close methods, depending on its collapsed state.
Additionally, to display the dropdown below the input group, you should configure the dropdown’s overlay settings and pass them to the open method. Also, to adjust the dropdown’s width according to the input width, you can get the input group element’s clientWidth and assign it to the dropdown element’s style.
For example:
<ng-template igxCell let-cell="cell"> <igx-input-group [type]="'border'" #inputGroup > <input igxInput name="town" type="text" [igxAutocomplete]="dropdown" [(ngModel)]="cell.value" /> <igx-suffix class="igx-combo__toggle-button" (click)="iconClick(inputGroup, dropdown)"> <igx-icon class="material-icons igx-icon" aria-hidden="true"> {{ dropdown.collapsed ? 'expand_more' : 'expand_less' }} </igx-icon> </igx-suffix> </igx-input-group> <igx-drop-down #dropdown> <div class="drop-down__scroll-container"> @for (town of cities | startsWith:cell.value; track town) { <igx-drop-down-item [value]="town.name" style="height: 28px"> {{ town.name }} </igx-drop-down-item> } </div> </igx-drop-down> </ng-template>
public iconClick( inputGroup: IgxInputGroupComponent, dropdown: IgxDropDownComponent ) { const inputGroupElement = inputGroup.element.nativeElement; const settings: OverlaySettings = { target: inputGroupElement, closeOnOutsideClick: false, }; Object.assign(dropdown.element.style, { width: `${inputGroupElement.clientWidth}px`, }); dropdown.collapsed ? dropdown.open(settings) : dropdown.close(); }
Lastly, since the dropdown is displayed inside an overlay element via our overlay service, I recommend referring to our Overlay topic, as well as the subtopics for further information on how to configure the settings, position, and style the element, etc.
Please test this approach on your side and let me know if you need any further assistance regarding this matter.
Sincerely, Riva Ivanova Software Developer
If i added igx-suffix, how do i trigger the popover/existing igx-drop-down's overlay-service when user clicks, so i could make it behaves like igx-simple-combo, where input binds to the PipeTransform?
<igx-input-group [type]="'border'"> <input igxInput name="town" type="text" [igxAutocomplete]="townsPanel" [(ngModel)]="cell.value" /> <igx-suffix class="igx-combo__toggle-button" (click)="iconClick()"> <igx-icon class="material-icons igx-icon" aria-hidden="true"> expand_more </igx-icon> </igx-suffix> </igx-input-group> iconClick(){ console.log("icon Click"); const ele = this.townsPanel?.nativeElement as HTMLElement; ele.showPopover(); }
I have been looking into your additional questions, and what I can say is that this behavior is by default, as the IgxSimpleCombo’s input is used both for filtering the values and displaying the selection. However, if there is no valid selection, blurring the combo’s input will clear the entered value, and this is the expected behavior.
For styling the autocomplete, the approach is similar to the IgxSimpleCombo in terms of setting the height. To change the colors, you should wrap the igx-drop-down-item components in a div element and set a custom class. Then, for this class, you should include the custom dropdown theme.
I believe that you will find the following topics quite helpful in customizing the IgxAutoComplete.
Using the Angular Input Group
Drop Down Styling
Here can be found a modified sample with a column that includes an IgxInputGroup with IgxAutoComplete.
Let me know if you need any further information on the matter.
What i am trying to do is a editable-dropdown, which is similar to autocomplete.
I do notice the igx-simple-combo will lose its value, once i try to click on it and onBlur(), eg: use this in athletesData
CountryName: 'California',
Is there anyway to retain it after onBlur()?
Or i have to use https://pt-br.infragistics.com/products/ignite-ui-angular/angular/components/autocomplete ?
anyway to style it identical to what you did on igx-simple-combo previously?