Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for SELECT OPTION #15

Closed
X13454 opened this issue Sep 24, 2014 · 8 comments
Closed

Add option for SELECT OPTION #15

X13454 opened this issue Sep 24, 2014 · 8 comments

Comments

@X13454
Copy link

X13454 commented Sep 24, 2014

Hello,

When your icon list is constructed in the following way, where 'id' is the database id:

<option value="id">fa fa-search</option>

fontIconPicker is going to use the 'id' for the class, as below:

<i data-fip-value"..." class="id"></i>

Would that be possible to add an option to specify for SELECT tag to use the OPTION tag's value attributes or the text between OPTION and /OPTION

It would mean using 'flipBoxTitle' instead of 'item' in line https://github.com/micc83/fontIconPicker/blob/master/jquery.fonticonpicker.js#L640

What do you think?

@micc83
Copy link
Owner

micc83 commented Sep 24, 2014

Hi @xavierfaucon, what about leaving the option value empty so fontIconPicker will use the option text as the value? This one look much like a one case scenario, it would be pointless to add this as an option.

@X13454
Copy link
Author

X13454 commented Sep 24, 2014

@micc83 I agree it's a specific scenario but it is linked with Symfony (2nd most popular framework on Github). By default, Symfony forms 'entity' uses the id for the OPTION tag.(http://symfony.com/fr/doc/current/reference/forms/types/entity.html).

I don't know if other framework do it the same way :-)

Another solution could be to choose the value between the OPTION tags in first choice, then if empty, the value attribute?

@micc83
Copy link
Owner

micc83 commented Sep 24, 2014

@xavierfaucon I see your point 😄
@swashata could you add a ignoreValue option to 2.1.0 so that one can choose to ignore value and use option text instead?

@swashata
Copy link
Collaborator

@micc83 and @xavierfaucon,

Indeed this is a very specific scenario. To globalize it a little, I was thinking perhaps, we can add an attribute data-icon-class to options tag, which if present would be used as the class of the generated <i data-fip-value="..."></i>. So effectively, <option data-icon-class="fa fa-search" value="1">Search</option> would render <i data-fip-value="1" class="fa fa-search"></i>.

Thoughts?

@swashata swashata added this to the v2.1.0 milestone Sep 24, 2014
@micc83
Copy link
Owner

micc83 commented Sep 24, 2014

I'm not into Symfony (more a Laravel guy 😄 ), i'm not sure how Symfony forms 'entity' works, perhaps @xavierfaucon knows better....

@X13454
Copy link
Author

X13454 commented Sep 24, 2014

@swashata if I understand correctly you propose that the initials OPTIONS from html contains 'data-icon-class'. It could work however this does not remove the pain to tweak an entity form (look at this for example :p :http://stackoverflow.com/questions/20509459/additional-properties-to-entity-field-type-in-a-form-in-symfony2).

Why not take the .text() value of the option and if .text() is empty, take the value attribute? (http://learn.jquery.com/using-jquery-core/faq/how-do-i-get-the-text-value-of-a-selected-option/)

@swashata
Copy link
Collaborator

With the intro of #39 I think this becomes useless as one can now render as needed. I will see if any other parameter needs to get exposed.

@swashata swashata modified the milestones: v2.1.0, v3.0.0 Mar 21, 2018
@swashata
Copy link
Collaborator

Closing as a future commit will expose item, flipBoxTitle, i to the renderer.

@swashata swashata moved this from To do to Done in Modernize with ES6, SCSS, Gulp Mar 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

3 participants