jQWidgets Forums

jQuery UI Widgets Forums Scheduler How to use getSelection with cellClick accurately?

This topic contains 3 replies, has 2 voices, and was last updated by  Stanislav 7 years, 3 months ago.

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

  • roshini.dav
    Participant

    Hi,

    Here is the code I have. It seems simple, but what I expect is that when I click on a cell and drag and release the mouse, then the selection should be the cells selected between these points. Problem is cellClick is called on mousedown only. Is there a way to detect mouseup, to the the getSelection working accurately with cellClick? With the given piece of code, after u drag and drop, you have to click on ANOTHER cell to get the selection correctly.

    I wanted to provide an example and tried to replace the cellClick in your example code (url: https://jseditor.io/?key=jqxscheduler-events) with this, but when I test it out, the behavior is different from what I see. Here, it only gets the from and to of a single clicked cell (again on mousedown) and does not get the selection at all, even when I select and then click elsewhere. Not sure if it is because of my version, we are on 4.2.1.

    $(“#scheduler”).on(‘cellClick’, function (event) {
    var selection = $(‘#scheduler’).jqxScheduler(‘getSelection’);
    if(selection !== null){
    var from = selection.from;
    var to = selection.to;
    console.log(“selected from: ” + from.toString() + ” to: ” + to.toString());
    };
    });

    Basically, what I’m trying to do is print the cell selection on mouseUp, i.e. I drag the mouse over a few cells and release it and I want to see the selected time printed on mouse release. Is this possible?
    Also, I am using timeline view of JQX scheduler, if that makes a difference.

    I appreciate your help.

    Thanks,
    Roshini


    roshini.dav
    Participant

    Works perfectly if I use a button and bind with that, rather than the cellClick.
    $(“#button”).on(‘click’, function (event) {

    But I need on mouse up event, after selecting the cells.


    roshini.dav
    Participant

    I just used regular JS mouseup.. and it works!

    $(“#scheduler”).on(“mouseup”, function (event) {


    Stanislav
    Participant

    Hello roshini.dav,

    Glad to hear you managed things on your own!

    Best Regards,
    Stanislav

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

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

You must be logged in to reply to this topic.