Lines 819-852
jQuery.fn.dataTable.ext.errMode = function(settings, note, message) {
Link Here
|
819 |
if ( $(this).data('filter') ) { |
819 |
if ( $(this).data('filter') ) { |
820 |
input_type = 'select' |
820 |
input_type = 'select' |
821 |
let filter_type = $(this).data('filter'); |
821 |
let filter_type = $(this).data('filter'); |
822 |
if ( filter_type == 'libraries' ) { |
822 |
var existing_search = table_dt.column(i).search(); |
823 |
var existing_search = table_dt.column(i).search(); |
823 |
let select = $('<select><option value=""></option></select'); |
824 |
let select = $('<select><option value=""></option></select'); |
824 |
|
825 |
|
825 |
// FIXME eval here is bad and dangerous, how do we workaround that? |
826 |
$(libraries).each(function(){ |
826 |
$(eval(filter_type)).each(function(){ |
827 |
let o = $('<option value="%s">%s</option>'.format(this.branchcode, this.branchname)); |
827 |
let o = $('<option value="%s">%s</option>'.format(this._id, this._str)); |
828 |
if ( existing_search == this.branchcode ) { |
828 |
if ( existing_search == this._id ) { |
829 |
o.prop("selected", "selected"); |
829 |
o.prop("selected", "selected"); |
830 |
} |
830 |
} |
831 |
o.appendTo(select); |
831 |
o.appendTo(select); |
832 |
}); |
832 |
}); |
833 |
$(this).html( select ); |
833 |
$(this).html( select ); |
834 |
} else if ( filter_type == 'categories' ) { |
|
|
835 |
var existing_search = table_dt.column(i).search(); |
836 |
let select = $('<select><option value=""></option></select'); |
837 |
|
838 |
$(categories).each(function(){ |
839 |
let o = $('<option value="%s">%s</option>'.format(this.categorycode, this.description)); |
840 |
if ( existing_search == this.categorycode ) { |
841 |
o.prop("selected", "selected"); |
842 |
} |
843 |
o.appendTo(select); |
844 |
}); |
845 |
$(this).html( select ); |
846 |
} else { |
847 |
console.log("Unknown filter " + filter_type); |
848 |
return; |
849 |
} |
850 |
} else { |
834 |
} else { |
851 |
var title = $(this).text(); |
835 |
var title = $(this).text(); |
852 |
var existing_search = table_dt.column(i).search(); |
836 |
var existing_search = table_dt.column(i).search(); |
853 |
- |
|
|