maxChars, maxCount, allowNotInList, destroy(), autogrow + bug fix #26

Open
wants to merge 5 commits into
from

3 participants

@baio

autogrow feature - input tag autogrow/shrink to fit text inside

destroy() - method which destroy widget

bug fix - position of widget must be inherited from original element

New options:

//user input restrictions

//max number of characters in single tag
maxChars

//max number of tags
maxCount

//allow tags which are not in tagSource list
allowNotInList

//events raised when user input restrictions occurs
onMaxChars,
onMaxCount,
onNotAllowed

@grisevg

What is that for?

when original element has absolute position, widget must be displayed at the same one

Maybe margins should be applied too then? And original 'display' property should be used too.

Yes will check it today evening.

@grisevg

Isn't UI Autocomplete already took care of that?

Without it, when user will choose something from drop down by up or down arrow, element in input tag will be visually trimmed (if the current width of input tag were smoller than text from the list)

@grisevg

Please, fix that

Will check it. When I tested it, all works fine without hat._tagInput.autocomplete('close'); Can you please give me more details why this line necessary (the comment above this line is not valid, I belive)

I'm talking about:
}
else{

it just wroooong

oh got it

@grisevg

What if both events happened? And you have wrong indentation here.

onMaxCount and onMaxChars can't happen simulteniously because if onMaxCount limit reached user just can't input something, hence onMaxChars can't happen.

Why it's 2 separate ifs then?

You mean it is better use "else if" instead?

It's easier to read(Reader will understand only one of ifs can happen) and takes less space.

@grisevg

Why not "if (that.options.allowNotInList)" ?

It is supposed that allowNotInList = unedfined and allowNotInList = null is the same as True. Maybe it is worth to change or make some notes in comments about this.

@grisevg

Please stop putting empty lines everywhere...

OK

@grisevg

Why again? It's already there on line 218

In line 218 - another else block

@grisevg

What if $.trim(that._tagInput.val()).length > that.options.maxChars ?

It just can't be, to assure this of cause can be used $.trim(that._tagInput.val()).length >= that.options.maxChars

Copy, Paste 200 chars? It can. And even if it couldn't, still >= would be better, you never can be sure.

will fix

@panozzaj

Found some code in here that I can use locally. Thanks!

@panozzaj you welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment