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

Already on GitHub? Sign in to your account

Dynamic Data Source #277

Open
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants

Firstly i want to congratulate loopj on Making such a beautiful Plugin
Recently i needed to integrate tokenInput Plugin with GMAP3 plugin(http://gmap3.net/examples/address-lookup.html)
But currently it can only have source as
oblject
url
Dynamic url function // NOTE:it can only compute url dynamically ,not response object

so i Have Made a attempt To Fetch Response Data Dynamically From Function With Asynchronous callback of GMAP3 (This is why i need to create Display() function)

it Can be used this way (eg. of GMAP3)

function googleFetch(query){
            var googleData=[];
            if(typeof query != 'undefined'){
             $("#test").gmap3({
              action:'getAddress',
              address:query,
              callback:function(results){
                for (var i = 0; i < results.length; i++) {
                 googleData.push({"name": results[i].formatted_address});
                }
                $("#input-field").tokenInput("display",googleData,query);
                }
            });
            }


   $("#input-field").tokenInput(
        googleFetch
        , {
                            tokenValue: "name",
            dynamicSource:true,
         });

All For the Sake of if Somebody needed to do something like this
code is working Bug Free for Me,But Certainly be refined

This is exactly what I need for my current project. My use case is that I'm integrating with mobile device APIs via PhoneGap.

That's what i really lacked in tokeninput. Thanks!

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