grid drag and drop goes in infinite loop

Posted by: priya_mehta on 11 February 2019, 5:49 pm EST

  • Posted 11 February 2019, 5:49 pm EST

    I want to disable one column which is type of combobox single click event
    for that i put a edit range also to disable
    but some time when i drag cell it goes in infinite loop

    and it return error at this point


    I also attached a video recorder alsogrid.zip
  • Replied 12 February 2019, 4:54 pm EST

    Hi,

    This issue seems to be related to drag-drop implementation. Could you please share a small sample replicating the issue so that we may investigate it further?

    Thanks in advance.
  • Replied 20 February 2019, 5:47 pm EST

    Thanks for the additional info. In the attached dragjs file, we could observe that you are using itemFormatter to make cells draggable. So, to disable the drag for a column, the best possible solution would be to just simply make cells not draggable inside the same itemFormatter function.
    Please make the following change in the itemFormatter function:
    // ....unchanged code

    // this is where we were previously making the cells draggable
    var lastItem = getLastDistribution();
    //enable cell drag and drop
    if (!scope.isJournalDisable && (panel.cellType === wijmo.grid.CellType.Cell || panel.cellType === wijmo.grid.CellType.RowHeader) &&
    lastItem.sequenceNumber !== row + 1) {
    cell.draggable = true;
    cell.droppable = true;
    } else {
    cell.draggable = false;
    }

    // just add the following additional check to disable drag
    if(columnBinding == "selectedAccount"){
    cell.draggable = false;
    cell.droppable = false; //if required
    }


    // .... rest of the unchanged code


    Please let us know if this doesn't work for you or you face any further issues.
  • Replied 20 February 2019, 11:49 pm EST

    I have added this code but still there is flickering issue and some time it able to drag the row
  • Replied 21 February 2019, 11:54 pm EST

    Hi,

    We are currently working on this and will reply to you soon.
    Sorry for the inconvenience caused.
  • Replied 24 February 2019, 9:48 pm EST

    Hi Priya,

    We are sorry but we are unable to replicate the issue at our end. We have prepared a sample based on the shared code snippet. Please have a look at it and let us know if we are missing something in order to replicate the issue:
    https://codepen.io/anon/pen/mobzXb?editors=1010
    You may also update the sample or share a new one replicating the issue so that we may investigate it any further.

    Thanks in advance.
  • Replied 25 February 2019, 4:03 pm EST

    Thanks,

    But in this sample you dont used a dropdown with single click event and then implement the drag and drop

    If you trying with this then you reproduce the bug




  • Replied 25 February 2019, 10:36 pm EST

    Thanks for the additional info.
    On further investigation, we found two more issues that could cause the problem in the scope.selectionChanged method.
    1). before starting the editing, check for columnSpan exists but not for rowSpan.
    2). in addition to 1, setTimeout is used to startEditing.
    Please make the following changes in the scope.selectionChanged method and check if the issue persists:
    scope.selectionChanged = function(s,e){
    .... unchanged code
    var column = s.columns[e.col];
    if(column.binding === 'selectedAccount' && !s.activeEditor && e.range && e.range.columnSpan === 1 && e.range.rowSpan === 1) {
    // remove timeout
    //setTimeout(function() {
    s.startEditing(true, e.row, e.col, true);
    //});
    }
    }
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels