PageSourceSearch

https://www.ncl-india.org/js/filter-icon-position-helper.js

js ncl-india.org collected 2026-10-02 04:06:57 UTC 2,291 bytes, 67 lines download raw bytes

1
2window.adjustFilterPosition = function (gridId, columnName) {
3    console.log('adjustFilterPosition called:', gridId, columnName);
4
5    try {
6        const gridElement = document.getElementById(gridId);
7        if (!gridElement) {
8            console.error('Grid element not found:', gridId);
9            return;
10        }
11
12        const filterPopup = document.querySelector('.e-filter-popup') ||
13            document.querySelector('.e-dialog[role="dialog"]') ||
14            document.querySelector('.e-popup-open');
15
16        if (!filterPopup) {
17            console.log('Filter popup not found, trying again...');
18            setTimeout(() => window.adjustFilterPosition(gridId, columnName), 50);
19            return;
20        }
21
22        const headers = gridElement.querySelectorAll('th');
23        let targetHeader = null;
24
25        for (let header of headers) {
26            const fieldAttr = header.getAttribute('data-field') ||
27                header.getAttribute('e-mappingname');
28            if (fieldAttr === columnName) {
29                targetHeader = header;
30                break;
31            }
32        }
33
34        if (!targetHeader) {
35            console.log('Target header not found for column:', columnName);
36            return;
37        }
38
39        const filterIcon = targetHeader.querySelector('.e-filtermenudiv') ||
40            targetHeader.querySelector('.e-icon-filter');
41
42        if (!filterIcon) {
43            console.log('Filter icon not found');
44            return;
45        }
46
47        const iconRect = filterIcon.getBoundingClientRect();
48        const popupRect = filterPopup.getBoundingClientRect();
49        const viewportWidth = window.innerWidth;
50
51        if (popupRect.right > viewportWidth) {
52            const newLeft = iconRect.left - popupRect.width + 20;
53            filterPopup.style.left = Math.max(10, newLeft) + 'px';
54            console.log('Filter popup position adjusted');
55        }
56
57    } catch (error) {
58        console.error('Filter position adjustment error:', error);
59    }
60};
61
62// Backup function - original style
63function filterIconPosition(args) {
64    if (args && args.requestType === 'filterafteropen') {
65        window.adjustFilterPosition('csirLabsGrid', args.columnName);
66    }
67}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.