Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If I understand you properly, you want the general code for selecting table cells, and changing properties (CSS attributes) for the selection.</p> <p>You can do this easily in jQuery.</p> <pre><code>var curTableCell = null; // "Softclicked" - not part of the selection (1) // We call this in the click event below. You'd probably want this for keyboard events as well (for arrow key nav, etc.) function softclick(element) { $(curTableCell).removeClass('softclicked'); curTableCell = element; $(element).addClass('softclicked'); } $('td, th').click(function() { if(keyHeld) { // Dunno how you do this (I'm not good at Javascript) $(this).toggleClass('selected'); // Explicitly added/removed to/from selection (2) } else { softclick(this); } }); /* When you want to do something on selection: */ $('td.selected, th.selected').css({borderColor: 'red', borderWidth: '1px'}); /* When you want to do something on selected tables (3): */ $('td.selected, th.selected').parents('table') .css({borderColor: 'red', borderWidth: '1px'}); $('td.selected, th.selected').parents('table').children('td') // Change things on all of table's cells .css({borderColor: 'red', borderWidth: '1px'}); $('td.selected, th.selected, td.softclicked, th.softclicked').parents('table').children('td') // Change things on all of table's cells, including tables of "softclicked" cells .css({borderColor: 'red', borderWidth: '1px'}); </code></pre> <p>(I am not too good at Javascript or jQuery (am learning at the moment), but I hope this is enough to get you started.)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload