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

Multiselect Dynamic Width

Open wei opened this issue 5 years ago • 2 comments

multi-item seems to have a fixed width, this works well for the demo where all the names are short but can dynamic(auto) widths be implemented for data sources that have variant text lengths?

image image

wei avatar Apr 12 '19 20:04 wei

In the jquery.magicsearch.css file, under .magicsearch-wrapper .multi-item, set width: auto;

seancosgrove avatar Jun 21 '19 17:06 seancosgrove

I owe this to a colleague. Posting it here just in case someone needs it in the future:

$("#basic").magicsearch({
    dataSource: data,
    fields: ['field1', 'field2'],
    id: 'id',
    format: '%field1%, %field2%',
    multiple: true,
    noResult: 'No results found.',
    multiStyle: {
       width: 'auto', // Add this part
    }
});

muonsei avatar Aug 18 '23 11:08 muonsei