forked from TFMM/silent-auction
fix: use native Tom Select sorting
This commit is contained in:
@@ -19,15 +19,16 @@
|
|||||||
dropdownParent: 'body',
|
dropdownParent: 'body',
|
||||||
controlInput: '<input>',
|
controlInput: '<input>',
|
||||||
sortField: [{
|
sortField: [{
|
||||||
field: 'text',
|
field: '$text',
|
||||||
direction: 'asc',
|
direction: 'asc'
|
||||||
func: function(a, b) {
|
}],
|
||||||
const a_val = a.text.split(' - ')[0];
|
render: {
|
||||||
const b_val = b.text.split(' - ')[0];
|
option: function(item, escape) {
|
||||||
return parseInt(a_val, 10) - parseInt(b_val, 10);
|
return '<div>' + escape(item.text) + '</div>';
|
||||||
}
|
}
|
||||||
}]
|
}
|
||||||
});
|
});
|
||||||
|
el.tomselect.sortOptions(); // Force initial sort
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user