start with complete rewrite
This commit is contained in:
parent
6f37cbf8ac
commit
8baaae8b16
1 changed files with 20 additions and 20 deletions
|
@ -5,14 +5,14 @@
|
||||||
%h3.panel-title Filters
|
%h3.panel-title Filters
|
||||||
.panel-body
|
.panel-body
|
||||||
.pure-g
|
.pure-g
|
||||||
.bound.input-listen.pure-u-1{ 'data-input-type': 'date-range' }
|
.bound.input-listen.pure-u-1{ 'data-input-type': 'date-range', 'data-input-value': ''}
|
||||||
%fieldset.pure-group-inline
|
%fieldset.pure-group-inline
|
||||||
%span.fa.fa-calendar.pure-group-addon
|
%span.fa.fa-calendar.pure-group-addon
|
||||||
%input.lower-bound{type: 'date', placeholder: 'after'}
|
%input.lower-bound{type: 'date', placeholder: 'after'}
|
||||||
\-
|
\-
|
||||||
%input.upper-bound{type: 'date', placeholder: 'before'}
|
%input.upper-bound{type: 'date', placeholder: 'before'}
|
||||||
.pure-g
|
.pure-g
|
||||||
.bound.input-listen.pure-u-1{ 'data-input-type': 'number-range' }
|
.bound.input-listen.pure-u-1{ 'data-input-type': 'number-range', 'data-input-value': ''}
|
||||||
%fieldset.pure-group-inline
|
%fieldset.pure-group-inline
|
||||||
%span.icon-euro.pure-group-addon
|
%span.icon-euro.pure-group-addon
|
||||||
%input.lower-bound.pure-group-addon{type: 'number', placeholder: 'Minimum'}
|
%input.lower-bound.pure-group-addon{type: 'number', placeholder: 'Minimum'}
|
||||||
|
@ -21,11 +21,11 @@
|
||||||
%span.icon-euro.pure-group-addon
|
%span.icon-euro.pure-group-addon
|
||||||
%input.upper-bound.pure-group-addon{type: 'number', placeholder: 'Maximum'}
|
%input.upper-bound.pure-group-addon{type: 'number', placeholder: 'Maximum'}
|
||||||
.pure-g
|
.pure-g
|
||||||
.input-listen.pure-u-md-1-4{ 'data-input-type': 'text' }
|
.input-listen.pure-u-md-1-4{ 'data-input-type': 'text', 'data-input-value': ''}
|
||||||
%input{type: 'text', placeholder: 'Filter on Issuer'}
|
%input{type: 'text', placeholder: 'Filter on Issuer'}
|
||||||
.input-listen.pure-u-md-1-4{ 'data-input-type': 'text' }
|
.input-listen.pure-u-md-1-4{ 'data-input-type': 'text', 'data-input-value': ''}
|
||||||
%input{type: 'text', placeholder: 'Filter on Peer'}
|
%input{type: 'text', placeholder: 'Filter on Peer'}
|
||||||
.input-listen.pure-u-md-1-2{ 'data-input-type': 'text' }
|
.input-listen.pure-u-md-1-2{ 'data-input-type': 'text', 'data-input-value': ''}
|
||||||
%input{type: 'text', placeholder: 'Filter on Message'}
|
%input{type: 'text', placeholder: 'Filter on Message'}
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,27 +56,27 @@
|
||||||
{ data: 'amount', name: 'Amount', width: "10%", className: 'min-mobile'},
|
{ data: 'amount', name: 'Amount', width: "10%", className: 'min-mobile'},
|
||||||
{ data: 'peer', name: 'Peer', width: "15%", className: 'min-mobile'},
|
{ data: 'peer', name: 'Peer', width: "15%", className: 'min-mobile'},
|
||||||
{ data: 'issuer', name: 'Issuer', width: "15%", className: 'min-desktop'},
|
{ data: 'issuer', name: 'Issuer', width: "15%", className: 'min-desktop'},
|
||||||
{ data: 'message', name: 'Message', width: "45%", className: 'min-tablet-p'},
|
{ data: 'message', name: 'Message', width: "45%", className: 'min-tablet-p'}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
var tds = $('.input-listen');
|
$('.input-listen').each(function(index, element) {
|
||||||
var i = 0;
|
var filter = $(element);
|
||||||
table.columns().every(function() {
|
var type = filter.attr('data-input-type');
|
||||||
var column = this
|
filter.find('input').on('keyup change', function() {
|
||||||
tds.eq(i).find('input').on('keyup change', function() {
|
var value = null
|
||||||
var value = null;
|
if(filter.hasClass('bound')) {
|
||||||
var td = $(this).parent();
|
var lower = filter.find('.lower-bound');
|
||||||
if(td.hasClass('bound')) {
|
var upper = filter.find('.upper-bound');
|
||||||
value = td.find('.lower-bound').val() + '~' + td.find('.upper-bound').val();
|
value = type + ':' + lower.val() + '~' + upper.val();
|
||||||
} else {
|
} else {
|
||||||
value = $(this).val()
|
value = type + ':' + $(this).val();
|
||||||
}
|
}
|
||||||
value = td.attr('data-input-type') + ':' + value
|
if(filter.attr('data-input-value') !== value) {
|
||||||
if(column.search() !== value) {
|
console.log(value);
|
||||||
column.search(value).draw();
|
filter.attr('data-input-value', value);
|
||||||
|
// TODO $.post(...)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
i = i + 1;
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue