Difference between revisions of "Widget:DCTList"

From LINKS Community Center
Jump to: navigation, search
Line 640: Line 640:
 
                 tabulator.setData(dcts);
 
                 tabulator.setData(dcts);
 
                 table = tabulator;
 
                 table = tabulator;
 +
 +
                // Set up the table if parameter was passed.
 +
                const params = new URLSearchParams(window.location.search);
 +
                const encoded = params.get('do');
 +
 +
                if (encoded) {
 +
                    const action = JSON.parse(decodeURIComponent(atob(encoded)));
 +
 +
                    const filter = action.filter;
 +
                    if (filter) {
 +
                        // Functions filter
 +
                        const functions = filter.functions;
 +
                        if (functions) {
 +
                            Object.keys(functions).forEach(fnCat => {
 +
                                document.getElementById('func-filter-' + escapeAttr(fnCat))
 +
                                    .closest('.func-filter-block')
 +
                                    .querySelectorAll('input[type="checkbox"]').forEach(box => box.checked = functions[fnCat]);
 +
                            });
 +
                        }
 +
 +
                        // Further filters
 +
                        // ...
 +
 +
                        applyFilters();
 +
                    }
 +
 +
                    // Further actions (e.g. open filter panel, etc.)
 +
                    // ...
 +
                }
 
             });
 
             });
  
Line 768: Line 797:
 
             // End bugfix
 
             // End bugfix
  
            // Set up the table if parameter was passed.
 
            const params = new URLSearchParams(window.location.search);
 
            const encoded = params.get('do');
 
 
            if (encoded) {
 
                const action = JSON.parse(decodeURIComponent(atob(encoded)));
 
 
                const filter = action.filter;
 
                if (filter) {
 
                    // Functions filter
 
                    const functions = filter.functions;
 
                    if (functions) {
 
                        Object.keys(functions).forEach(fnCat => {
 
                            document.getElementById('func-filter-' + escapeAttr(fnCat))
 
                                .closest('.func-filter-block')
 
                                .querySelectorAll('input[type="checkbox"]').forEach(box => box.checked = functions[fnCat]);
 
                        });
 
                    }
 
 
                    // Further filters
 
                    // ...
 
 
                    applyFilters();
 
                }
 
 
                // Further actions (e.g. open filter panel, etc.)
 
                // ...
 
            }
 
 
         });
 
         });
  

Revision as of 15:32, 24 November 2022

Development verstion of the DCT List.
Not ready for production!