function formatSize (size) {
if (!size.id) {
return size.text;
}
if (size.element.attributes[3].value == "") {
var $size = $(
'<div>' + size.text + ' <span style="color:#666">' + size.element.attributes[2].value + '</span></div>'
);
}
else {
var $size = $(
'<div><b>' + size.text + '</b> <span style="color:#666">' + size.element.attributes[2].value + '</span></div><div>' + size.element.attributes[3].value + '</div>'
);
}
return $size;
};
$("#size_select").select2({
minimumResultsForSearch: Infinity,
templateResult: formatSize,
width: '70%'
});
Array
(
[0] => 80
[1] => 80
[2] => 90
[3] => 90
[4] => 90
)
Array
(
[0] => Array
(
[0] => 190
)
[1] => Array
(
[0] => 200
)
[2] => Array
(
[0] => 190
)
[3] => Array
(
[0] => 195
)
[4] => Array
(
[0] => 200
)
)
Array
(
[80] => Array
(
[0] => 200
)
[90] => Array
(
[0] => 200
)
)
Array
(
[80] => Array
(
[0] => 190
[1] => 200
)
[90] => Array
(
[0] => 190
[1] => 195
[2] => 200
)
)