Add 'filtering' for purchase order line item table

This commit is contained in:
Oliver 2021-10-05 16:57:33 +11:00
parent 87f1bd87e7
commit 5e951ef64b
3 changed files with 20 additions and 0 deletions

View File

@ -32,6 +32,9 @@
</button> </button>
{% endif %} {% endif %}
{% endif %} {% endif %}
<div class='filter-list' id='filter-list-purchase-order-lines'>
<!-- An empty div in which the filter list will be constructed-->
</div>
</div> </div>
<table class='table table-striped table-condensed' id='po-line-table' data-toolbar='#order-toolbar-buttons'> <table class='table table-striped table-condensed' id='po-line-table' data-toolbar='#order-toolbar-buttons'>

View File

@ -273,6 +273,11 @@ function setupFilterList(tableKey, table, target) {
var element = $(target); var element = $(target);
if (!element) {
console.log(`WARNING: setupFilterList could not find target '${target}'`);
return;
}
// One blank slate, please // One blank slate, please
element.empty(); element.empty();

View File

@ -665,6 +665,18 @@ function loadPurchaseOrderTable(table, options) {
*/ */
function loadPurchaseOrderLineItemTable(table, options={}) { function loadPurchaseOrderLineItemTable(table, options={}) {
options.params = options.params || {};
var filters = loadTableFilters('purchaseorderlineitem');
for (var key in options.params) {
filters[key] = options.params[key];
}
var target = options.filter_target || '#filter-list-purchase-order-lines';
setupFilterList('purchaseorderlineitem', $(table), target);
function setupCallbacks() { function setupCallbacks() {
if (options.allow_edit) { if (options.allow_edit) {
$(table).find('.button-line-edit').click(function() { $(table).find('.button-line-edit').click(function() {