ДЛЯ РАЗМОРАЖИВАНИЯ ДЛЯ ВСЕГО ПРОЕКТА
$(document).ready(function () {
$.when($('select').addClass('auto-drop-sort')).then($.fn.sortDropOptions("auto-drop-sort"))
})
/*sort all dropdown*/
$.fn.sortDropOptions = function(dropdown_class){
var prePrepend = ".";
if (dropdown_class.match("^.") == ".") prePrepend = "";
var myParent = $(prePrepend + dropdown_class);
$.each(myParent, function(index, val) {
/*if any select tag has this class 'manual-drop-sort' this function wont work for that particular*/
if ( ! $(val).hasClass('manual-drop-sort') ) {
var selectedVal = $(val).val()
$(val).html($(val).find('option').sort(
function (a, b) {
if ( a.value != -1 && a.value != 0 && a.value != '' ) {
return a.text == b.text ? 0 : a.text < b.text ? -1 : 1
}
})
);
$(val).val(selectedVal)
}else{
/* set custom sort for individual select tag using name/id */
}
});
}
let array = [
{columnsexpo: "First Name", placeholder: true},
{columnsexpo: "Middle Name / Initial", placeholder: true},
{columnsexpo: "Last Name", placeholder: true},
{columnsexpo: "Email", placeholder: true},
{columnsexpo: "Work Experience / Begin date", placeholder: true}
]
const removeItem = value => array.filter(item => item.columnsexpo !== value)
console.log(removeItem("First Name"))