Skip to content
This repository has been archived by the owner on Sep 28, 2020. It is now read-only.

fix resize bug and support custom attributes. #143

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

icai
Copy link

@icai icai commented Jul 10, 2014

resize bug:

when form field use 'col-md-x' to wrap it, resize window will have problem.

support custom attributes, for example

$(selector).tokenfield({
        autocomplete: {
            source: [
            {
                value: 'green',
                label: 'green',
                image: 'assets/images/case-1.png'
            },
            {
                value: 'red',
                label: 'red',
                image: 'assets/images/case-2.png'
            },
            {
                value: 'blue',
                label: 'blue',
                image: 'assets/images/case-3.png'
            },
            {
                value: 'kl10',
                label: 'kl10',
                image: 'assets/images/avatar-32-1.png'
            },
            {
                value: 'kw10',
                label: 'kw10',
                image: 'assets/images/avatar-32-2.png'
            },
            {
                value: 'kx10',
                label: 'kx10',
                image: 'assets/images/avatar-32-3.png'
            },{
                value: 'ww10',
                label: 'ww10',
                image: 'assets/images/avatar-34-2.png'

            },{
                value: 'pv120',
                label: 'pv120',
                image: 'assets/images/avatar-34-3.png'  
            },{
                value: 'gd123',
                label: 'gd123',
                image: 'assets/images/avatar-34.png'

            }],
            delay: 100,
            renderItem: function(ul, item){
                return $( "<li>" )
                    .append( $( "<a>" ).html( '<img src="'+ item.image +'" alt="" width="32" height="32" /> <span>' + item.label + '</span>' ) )
                    .appendTo( ul );
            }

        },
        showAutocompleteOnFocus: !0,
        delimiter: [",", " ", "-", "_"],
        template:{
            token: '<div class="token square" data-value="{{value}}"><span class="token-label"><img src="{{image}}" alt="{{label}}" width="20" height="20" /><span>{{label}}</span></span><a href="#" data-bind="close" class="close" tabindex="-1">×</a></div>'
        }
    })

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant