jquery-tokeninput icon indicating copy to clipboard operation
jquery-tokeninput copied to clipboard

Dynamic Data Source

Open jaideep87 opened this issue 13 years ago • 2 comments

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

jaideep87 avatar Feb 13 '12 07:02 jaideep87

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

rhysyngsun avatar Mar 04 '12 15:03 rhysyngsun

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

grigorkin avatar May 12 '12 04:05 grigorkin