jui_datagrid icon indicating copy to clipboard operation
jui_datagrid copied to clipboard

Select rows using CTRL CLICK and SHIFT CLICK

Open pontikis opened this issue 13 years ago • 0 comments

CTRL CLICK and SHIFT CLICK could be detected as follows http://stackoverflow.com/questions/9451726/multiple-item-selection-by-pressing-ctrl-button

$("#" + table_id + " tbody tr").click(function(event) {

    event.preventDefault();

    if(event.ctrlKey) {
        alert('ctrl click');
    }
    else if(event.shiftKey) {
        alert('shift click');
    } else {
        alert('click');
    }

});

To suppressing actual text selection http://stackoverflow.com/questions/5851156/javascript-drag-select-functionality-done-right

$("#" + table_id + " tbody tr").mousedown(function(event) {
    event.preventDefault();
}).mouseup(function(event) {
        event.preventDefault();
    });

But touch devices cannot support CTRL CLICK and SHIFT CLICK. Here the solution is checkboxes

In case of using checkboxes preventing click, check can not be performed. A solution might be http://stackoverflow.com/questions/7610871/how-to-trigger-an-event-after-using-event-preventdefault

pontikis avatar Oct 15 '12 17:10 pontikis