2025-01-17 11:03:00 +01:00
|
|
|
// Grid class
|
|
|
|
class BrickGrid {
|
2025-01-30 22:07:09 +01:00
|
|
|
constructor(grid, target = "div#grid>div") {
|
2025-01-24 15:55:15 +01:00
|
|
|
this.id = grid.id;
|
2025-01-30 22:07:09 +01:00
|
|
|
this.target = target;
|
2025-01-17 11:03:00 +01:00
|
|
|
|
|
|
|
// Grid elements (built based on the initial id)
|
2025-01-24 15:55:15 +01:00
|
|
|
this.html_grid = document.getElementById(this.id);
|
2025-01-17 11:03:00 +01:00
|
|
|
|
|
|
|
if (this.html_grid) {
|
2025-01-30 22:40:53 +01:00
|
|
|
// Sort setup
|
|
|
|
this.sort = new BrickGridSort(this);
|
2025-01-17 11:03:00 +01:00
|
|
|
|
2025-01-30 22:40:53 +01:00
|
|
|
// Filter setup
|
|
|
|
this.filter = new BrickGridFilter(this);
|
2025-01-17 11:03:00 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2025-01-24 15:55:15 +01:00
|
|
|
|
|
|
|
// Helper to setup the grids
|
|
|
|
const setup_grids = () => document.querySelectorAll('*[data-grid="true"]').forEach(
|
|
|
|
el => new BrickGrid(el)
|
|
|
|
);
|