Я хочу сделать код, подобный этому https://l -lin.github.io / angular-datatables / # / advanced / custom-range-search ... Но с датой и я нене знаю как.Я пытаюсь сделать то же самое, но меняю переменные, но не могу.На самом деле у меня одинаковый код ссылки
@ViewChild(DataTableDirective)
datatableElement: DataTableDirective;
public logs: LogsTabla[];
dtTrigger: Subject<any> = new Subject();
min: number;
max: number;
constructor(private _auditoriaService: AuditoriaService) { }
ngOnInit():void {
$.fn['dataTable'].ext.search.push((settings, data, dataIndex) => {
const id = parseFloat(data[0]) || 0; // use data for the id column
if ((isNaN(this.min) && isNaN(this.max)) ||
(isNaN(this.min) && id <= this.max) ||
(this.min <= id && isNaN(this.max)) ||
(this.min <= id && id <= this.max)) {
return true;
}
return false;
});
и HTML
<form (submit)="filterById()">
<label>
Min
<input type="number" name="min" id="min" [(ngModel)]="min" />
</label>
<label>
Max
<input type="number" name="max" id="max" [(ngModel)]="max" />
</label>
<button class="btn btn-primary" type="submit">Filter by ID</button>
</form>
<br />