how to add a image next to a list item in ajax combobox
how to add a image next to a list item in ajax combobox
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jaganathan BantheswaranPosted Mar 13, 2014, 5:53 AM
You can use http://brianreavis.github.io/selectize.js/.
$('#select-movie').selectize({
valueField: 'title',
labelField: 'title',
searchField: 'title',
options: [],
create: false,
render: {
option: function(item, escape) {
var actors = [];
for (var i = 0, n = item.abridged_cast.length; i < n; i++) {
actors.push('' + escape(item.abridged_cast[i].name) + '');
}
return '
'
'' +
'' + escape(item.title) + '' +
'' +
'' + escape(item.synopsis || 'No synopsis available at this time.') + '' +
'' + (actors.length ? 'Starring ' + actors.join(', ') : 'Actors unavailable') + '' +
'
}
},
load: function(query, callback) {
if (!query.length) return callback();
$.ajax({
url: 'http://api.rottentomatoes.com/api/public/v1.0/movies.json',
type: 'GET',
dataType: 'jsonp',
data: {
q: query,
page_limit: 10,
apikey: '3qqmdwbuswut94jv4eua3j85'
},
error: function() {
callback();
},
success: function(res) {
callback(res.movies);
}
});
}
});
Dharani dharanPosted Mar 13, 2014, 1:50 AM
http://www.telerik.com/help/aspnet-ajax/combobox-appearance-item-images.html
https://demos.devexpress.com/ASPxEditorsDemos/ASPxComboBox/ImageEditBox.aspx
Please refer the above links it will help u.