Difference between revisions of "Widget:UseCaseList"

From LINKS Community Center
Jump to: navigation, search
Line 373: Line 373:
 
         Promise.all([getUseCases()]).then(data => {
 
         Promise.all([getUseCases()]).then(data => {
 
             const useCases = data[0];
 
             const useCases = data[0];
 +
            console.log(useCases)
  
 
             let THEME_VALUES = []
 
             let THEME_VALUES = []
Line 528: Line 529:
 
             tabulator.on('tableBuilt', () => {
 
             tabulator.on('tableBuilt', () => {
 
                 tabulator.redraw(true);
 
                 tabulator.redraw(true);
                console.log('done')
 
 
                 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 actions = JSON.parse(decodeURIComponent(atob(encoded)));
 +
                    const filter = actions.filter;
 +
 +
                    if (filter) {
 +
                        const thematic = filter[THEME_PROP];
 +
                        if (thematic) {
 +
                            Object.keys(thematic).forEach(theme => {
 +
                                const box = document.getElementById('thematic-filter-' + escapeAttr(theme));
 +
                                box.checked = !!thematic[theme];
 +
                                box.dispatchEvent(new Event('change', { bubbles: true }));
 +
                            });
 +
 +
                            document.getElementById('thematic-filter').closest('.filter-wrapper').classList.toggle('open');
 +
                        }
 +
 +
                        applyFilters();
 +
                        toggleFilter();
 +
                    }
 +
 +
                    // Further actions (e.g. open filter panel, etc.)
 +
                    // ...
 +
                }
  
 
             });
 
             });

Revision as of 14:33, 23 June 2023

Current version of the List of Use Cases.
currently in use!