Selectr icon indicating copy to clipboard operation
Selectr copied to clipboard

width option not working

Open 1grafik opened this issue 6 years ago • 3 comments

I don't know much about English, so I'm sorry.

build() method that changes the width of the code does not work.

Fix: Replace : if (isset(this.config, "width"))

To: if (typeof this.config.width !== 'undefined')

1grafik avatar Feb 25 '19 09:02 1grafik

thanks for that, it's work for me (and before not).

coolibry avatar Mar 23 '19 13:03 coolibry

Yes, thanks so much for this suggested change. Without it, width option doesn't apply for me when used like:

var newSelectr = new Selectr('#some-id', { searchable: false, width: 190 });

davidjkrause avatar Mar 31 '19 19:03 davidjkrause

The problem is still there in production version (minified). If you use: width: 190 then, "isset" call from line 331 (patched by @1grafik as a solution ) returns false because condition (obj[prop] === true || obj[prop].length) is evaluated as false since first part is false and second part is undefined If you use: width: "190" "isset" call from line 331 returns true but "util.isInt" call returns false since first condition: typeof val === 'number' is false (obviosly)

NitemareReal avatar Oct 30 '19 00:10 NitemareReal