ngx-select-ex icon indicating copy to clipboard operation
ngx-select-ex copied to clipboard

How to make list width adaptive data length in the list

Open DaLiangLee opened this issue 7 years ago • 16 comments
trafficstars

How to make list width adaptive data length in the list

DaLiangLee avatar Jun 22 '18 09:06 DaLiangLee

1

DaLiangLee avatar Jun 22 '18 09:06 DaLiangLee

I know that overriding the css style is a way, but the css class name will change... thanks for your reply

DaLiangLee avatar Jun 22 '18 09:06 DaLiangLee

...I hope to get your help..

DaLiangLee avatar Jun 25 '18 01:06 DaLiangLee

Override the css. The ngx-select__... classes I'll not change.

optimistex avatar Jun 25 '18 08:06 optimistex

width: 100%.... how to override....

DaLiangLee avatar Jun 25 '18 09:06 DaLiangLee

width: auto !important;

optimistex avatar Jun 25 '18 09:06 optimistex

thanks...

DaLiangLee avatar Jun 25 '18 10:06 DaLiangLee

.ngx-select__choices[_ngcontent-c8] / .ngx-select__choices[_ngcontent-c7] / but it can change...

DaLiangLee avatar Jun 25 '18 10:06 DaLiangLee

Make the CSS:

.ngx-select__choices {
   width: auto !important;
}

It have to overrides the style.

And... Make it out of a component. Or make it with /deep/, but it is deprecated now: https://angular.io/guide/component-styles#deprecated-deep--and-ng-deep

optimistex avatar Jun 25 '18 11:06 optimistex

Successfully solved with your help, thanks martin_2018-06-26_09-15-00

DaLiangLee avatar Jun 26 '18 01:06 DaLiangLee

I have a new question... Before using angular pipe to remove the leading zero in the data.. but now, i don't know how to remove leading zero. Thank you in advance for your reply

DaLiangLee avatar Jun 28 '18 02:06 DaLiangLee

@DaLiangLee I do not understand. Show your code.

optimistex avatar Jun 28 '18 02:06 optimistex

<div class="form-group"> <label>Delivery</label> <select class="form-control" (change)="saveSelectedFilter(list,'deliveryOrderId',deliveryOrderId)" [(ngModel)]="deliveryOrderId" name="deliveryOrderId"> <option *ngFor="let item of deliveryOrderIDs" value="{{item.value}}"> {{item.text|removeLeadingZeros}} </option> </select> </div> martin_2018-06-28_10-50-42

DaLiangLee avatar Jun 28 '18 02:06 DaLiangLee

`

                <label>Delivery</label>
                <select class="form-control" 
                    (change)="saveSelectedFilter(list,'deliveryOrderId',deliveryOrderId)" 
                     [(ngModel)]="deliveryOrderId" name="deliveryOrderId">
                    <option *ngFor="let item of deliveryOrderIDs" value="{{item.value}}">
                        {{item.text|removeLeadingZeros}}
                    </option>
                </select>
            </div>`

DaLiangLee avatar Jun 28 '18 02:06 DaLiangLee

Try the templates: https://github.com/optimistex/ngx-select-ex#templates

optimistex avatar Jun 28 '18 02:06 optimistex

Thanks a lot.

DaLiangLee avatar Jun 28 '18 02:06 DaLiangLee