Overview
Comment: | Improve/fix checking of all checkboxes in a table |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
75e626819a6fc98019479097bbeb49a9 |
User & Date: | bohwaz on 2020-11-18 13:51:47 |
Other Links: | branch diff | manifest | tags |
Context
2020-11-18
| ||
19:56 | Try to magically match columns with the same header label in CSV import check-in: 7ee830853d user: bohwaz tags: dev | |
13:51 | Improve/fix checking of all checkboxes in a table check-in: 75e626819a user: bohwaz tags: dev | |
13:08 | Fix checkbox sending back to top of the page check-in: 33290306f7 user: bohwaz tags: dev | |
Changes
Modified src/www/admin/static/scripts/global.js from [30f1b3874f] to [2ad4a5110b].
︙ | ︙ | |||
146 147 148 149 150 151 152 | } // From KD2fw/js/xhr.js g.load = function(b,d,f,e){var a=new XMLHttpRequest();if(!a||!b)return false;if(a.overrideMimeType)a.overrideMimeType('text/xml');b+=(b.indexOf('?')+1?'&':'?')+(+(new Date));a.onreadystatechange=function(){if(a.readyState!=4)return;if((s=a.status)==200){if(!d)return true;var c=a.responseText;if(f=='json'){return((j=window.JSON)&&j.parse)?j.parse(c):eval('('+c.replace(/[\n\r]/g,'')+')')}d(c)}else if(e){e(s)}};a.open('GET',b,true);a.send(null)}; g.checkUncheck = function() { | < < | < < < > | > > > | 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | } // From KD2fw/js/xhr.js g.load = function(b,d,f,e){var a=new XMLHttpRequest();if(!a||!b)return false;if(a.overrideMimeType)a.overrideMimeType('text/xml');b+=(b.indexOf('?')+1?'&':'?')+(+(new Date));a.onreadystatechange=function(){if(a.readyState!=4)return;if((s=a.status)==200){if(!d)return true;var c=a.responseText;if(f=='json'){return((j=window.JSON)&&j.parse)?j.parse(c):eval('('+c.replace(/[\n\r]/g,'')+')')}d(c)}else if(e){e(s)}};a.open('GET',b,true);a.send(null)}; g.checkUncheck = function() { var checked = this.checked; this.form.querySelectorAll('tbody input[type=checkbox]').forEach((elm) => { elm.checked = checked; elm.dispatchEvent(new Event("change")); }); this.form.querySelectorAll('thead input[type=checkbox], tfoot input[type=checkbox]').forEach((elm) => { elm.checked = checked; }); return true; }; g.togglePasswordVisibility = (field, repeat, show) => { if (typeof show == 'undefined') { show = field.type.toLowerCase() == 'password'; |
︙ | ︙ | |||
326 327 328 329 330 331 332 | } this.form.submit(); }; } // Ajouter action check/uncheck sur les checkbox de raccourci dans les tableaux | | < < < < < | < < < < < < | < < | < < < < < | < | < < < | < < < < < | < < < < < | | < < | 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | } this.form.submit(); }; } // Ajouter action check/uncheck sur les checkbox de raccourci dans les tableaux document.querySelectorAll('table thead input[type=checkbox], table tfoot input[type=checkbox]').forEach((elm) => { elm.addEventListener('change', g.checkUncheck); }); document.querySelectorAll('table tbody input[type=checkbox]').forEach((elm) => { elm.addEventListener('change', () => { elm.parentNode.parentNode.classList.toggle('checked', elm.checked); }); }); }); })(); |