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