I've been working on this solution for a few days now and get seem to get it working. I'm able to query the results and post to the server which all is working fine and passing value. I'm pulling the remote source data into a json structure for the autocomplete typeahead, but when I select the item, I need to dynamically set the data-pk value from the json values that I'm pulling. Not sure what I'm missing. But here is my code below. As you can see below...I need to populate the 'data-pk' field from my typeahead selection from the remote source. Can anyone provide a hint ?
<a href="#" id="ProfileMappedCityStateLocation" class="twitter-typeahead" data-type="typeaheadjs" data-pk="" data-url="/profile/updatelocation" autocomplete="on" data-title=""></a>
$('#ProfileMappedCityStateLocation').editable({
success: function (response, value) {
// do something here with value. e.x., ( Chicago, Illinois)
},
params: function (params) {
//originally params contain pk, name and value
return params;
},
typeahead: {
hint: true,
highlight: true,
displayKey: 'value',
name: 'ProfileMappedCityStateLocation',
remote: { url: 'profile/locationsearch?q=%QUERY' },
prefetch: { url: '/profile/locationsearch' },
minLength: 5,
engine: Hogan,
template: function (item) {
return item.value;
}
}