Adding shiftKey to builder.js?
  • Hey Dev team.

    Im looking to bind shiftClick to multiple select the tiny red markers in the shows list in "Now Playing"..their class is .marker

    When ctrl clicking the markers they are selected..but i want a shift click to multiple selct them all without going one by one.

    If i'm not misstaking this needs to be in builder.js?

    this is the ctrlClick event if i'm not misstaking:

    $sbTable.find("tbody").on("click", "div.marker", function(event) {
                var $tr = $(this).parents("tr"),
                    $trs;
                
                if ($tr.hasClass(CURSOR_SELECTED_CLASS)) {
                    mod.removeCursor($tr);
                }
                else {
                    mod.selectCursor($tr);
                }
                
                if (event.ctrlKey === false) {
                    $trs = $sbTable.find('.'+CURSOR_SELECTED_CLASS).not($tr);
                    mod.removeCursor($trs);
                }
                
                         
                return false;
            });
     

    What should i add in order to achieve multiple selection by shiftClick?
    Post edited by Guytrance at 2012-12-06 07:59:13
  • 4 Comments sorted by
  • You're looking in the right place. You can modify the code you pasted to the following but it will only work moving from top to bottom.

    $sbTable.find("tbody").on("click", "div.marker", function(event) {
                var $tr = $(this).parents("tr"),
                    $trs;
                
                if ($tr.hasClass(CURSOR_SELECTED_CLASS)) {
                    mod.removeCursor($tr);
                }
                else {
                    if (event.shiftKey === true) {
                        mod.selectCursor($tr.siblings().prevAll('.'+CURSOR_SELECTED_CLASS).first().nextUntil($tr));
                    } else if (event.ctrlKey === false) {
                        $trs = $sbTable.find('.'+CURSOR_SELECTED_CLASS).not($tr);
                        mod.removeCursor($trs);
                    }
                    mod.selectCursor($tr);
                }
                
                return false;
            });

    Hope it helps!
  • You Just made my Airtime experience a lot more easier and enjoyable :)

    Thank you !


  • Reply to @Denise+Rigato:

    Hi Denise.

    I stumbled upon a glitch in that code..

    When i click the shift key and select multiple shows, it selects them ok but when i insert a webstream block from the left panel it adds multiple blocks to the show even though both the block and the shows are set to 1 hour.

    If i use the ctrl click on each of the markers then adding the block it will add only one.

    So i need that shiftkey to let me add one block..not a bunch (usually it ads 3)

    Amy idea?
    Post edited by Guytrance at 2012-12-09 12:09:23
  • I tried to recreate the scenario you are describing but it seems to be working as expected for me. I shift-clicked to select a few rows, on the library side I selected a webstream, and clicked 'Add to selected show'. The result was that only one webstream block was added to each cursor position.

    Maybe I am not understanding properly. Can you attach a screenshot of the result?