jQWidgets Forums

jQuery UI Widgets Forums Grid multiplecellsadvanced and getselectedcells

This topic contains 5 replies, has 3 voices, and was last updated by  Dimitar 9 years, 8 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author

  • JRoseman
    Participant

    I’ll keep this short and sweet. I’m looking to understand how to implement a multiplecellsadvanced and get the final array of selected cells when the user clicks, drags and releases the mouse.

    In other words I’d like the mouseup to be the event that ends the “capture” but it seems the only way to do that is to embed a mouseup listener within the cellselect binding – a task I’ve had no luck with so far as the mouseup is tied to the cell that received the mousedown. If you console.log the getselectedcells array you’ll see it only contains the cell on which you clicked, not the one you ended on nor the ones between.

    Using this as a base (or maybe I’m way off base…) how would one consume the getselectedcells array upon mouseup?

    $("#myGrid").bind('cellselect', function (event) {
    var cells = $('#myGrid').jqxGrid('getselectedcells');
    console.log('cells = ', cells);
    });

    Dimitar
    Participant

    Hello JRoseman,

    In this case, the dragEnd event is more suitable. Please check out the Drag & Drop-related examples in the jqxGrid demo section to see how to properly bind to the cells’ dragEnd event.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/


    JRoseman
    Participant

    Sorry, perhaps I’m missing something.

    Implementing .jqxDragDrop under the Grid’s rendered event seems to negate a selectionmode of multiplecellsadvanced. The mouse drag attempts to drag the cell you clicked on rather than allow you to highlight multiple cells (the functionality enabled by multiplecellsadvanced). Your demo shows a singlecell selectionmode. Could my issue be that I’m not setting the dropTarget to a second Grid but rather the same Grid? In other words I’m not moving cells from one Grid to another, I’m attempting to move cells within a Grid, hence my dropTarget is the same as my source Grid.

    I tried implementing a dragEnd listener without initiating .jqxDragDrop but I’m assuming this isn’t possible as it didn’t work.

    I’ll try setting up a Fiddle so I can share the full extent of my code.

    multiplecellsadvanced and getselectedcells #32209

    JRoseman
    Participant

    I got it working in this fiddle – now I just need to figure out what’s wrong in my code!

    Thanks for the help!!

    multiplecellsadvanced and getselectedcells #76031

    dagle
    Participant

    I got excited when I saw this question come up on Google since I really needed this. 🙁

    multiplecellsadvanced and getselectedcells #76093

    Dimitar
    Participant

    Hello dagle,

    This topic is almost two years old. Currently (with version 3.8.2), the getselectedcells method works perfectly fine with selectionmode: 'multiplecellsadvanced', as shown by the following example: https://www.jseditor.io/?key=multiplecellsadvanced-and-getselectedcells.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.