After dragging, sometimes the flexgrid.collectionView.currentItem will be null

Posted by: frhave on 18 December 2017, 5:25 am EST

    • Post Options:
    • Link

    Posted 18 December 2017, 5:25 am EST

    After dragging, the flexgrid.collectionView.currentItem will be null.

    steps:

    1. open the link http://jsfiddle.net/ggu0wfyr/

      2.drag the 7th row’s header to the postion 2th row.
    2. clik the Get current item button.

      you can see, the theGrid.collectionView.currentItem become null.

    steps1:

    1. open the link http://jsfiddle.net/ggu0wfyr/

      2.drag the 2th row’s header to the postion 7th row.
    2. clik the Get current item button.

      you can see, the theGrid.collectionView.currentItem has the right value.

    so. drag the bottem row up, the theGrid.collectionView.currentItem will become null,

    drag the top row down, the theGrid.collectionView.currentItem will be right.

    thanks.

  • Posted 18 December 2017, 5:37 am EST

    the step 1 is:

    1. open the link http://jsfiddle.net/dxz498z4/
  • Posted 18 December 2017, 9:13 pm EST

    Hi,

    Thank you for reporting this issue. We are able to replicate the issue at our end. Hence, this issue has been forwarded to the concerned team for further investigation with id 301525.

    We will let you know as we get any update on this issue.

    ~Manish

  • Posted 19 December 2017, 2:50 pm EST

    Hello

    The row dragging feature was designed mainly for use in unbound scenarios.

    When you drag rows on a bound grid, they get out of sync with the data source (row 4 may refer to item 6 for example).

    The solution is to handle the draggedRow event and synchronize the data with the new row positions. Also remember to set the allowSorting property to false or you will have no control over the row order (it will be determined only by the data).

    This fiddle demonstrates:

    http://jsfiddle.net/Wijmo5/kyg0qsda/

    I hope this clarifies the issue.

  • Posted 20 December 2017, 3:10 am EST

    except the problem i list above, i also found some other strange problems after dragging rows,

    since dragging feature was not designed for use in bound scenarios, maybe it is better explained in the document, don’t allow people to use dragging feature in bound scenarios.

    thanks!

  • Posted 20 December 2017, 10:16 pm EST

    Hi,

    Could you please let us know the problem you are facing with dragging feature so that we can have a look on this?

    We are agree to mention this in documentation. We will address it to the concerned team along with your issue.

    ~Manish

  • Posted 7 February 2018, 11:52 pm EST

    The next maintenance release has expanded documentation and includes remarks and examples in this area.

    Thank you very much for the suggestion.

  • Posted 18 May 2019, 7:23 pm EST

    Is this issue resolved , i am still facing the same Issue while dragging rows sometimes the collectionView become null and hence the currentItem is undefined.

    Thanks,

    Arjun

  • Posted 19 May 2019, 8:05 pm EST

    Hi Arjun,

    As explained earlier, enabling dragging rows in bound scenario causes the grid rows to get out of sync with the data. To prevent this we need to handle the draggedRow event and change the order of items to match the row.

    Please refer to the following sample which demonstrates the same:

    http://jsfiddle.net/Wijmo5/kyg0qsda/

    Regards

  • Posted 21 May 2019, 8:26 pm EST

    Thanks sharad,

    i am able to enable row dragging on bounded rows, however , it is not updating the sourceCollection of wijmo, after dragging the sourceCollection remains same as before.

    can you please have a look on it.

    Thanks,

    Arjun

  • Posted 22 May 2019, 12:59 am EST

    Sharad/ Team,

    Is there any way to save the dragged row index, so that even on page refresh or collection refresh the dragged row remain at there new location.

    Thanks,

    Arjun

  • Posted 22 May 2019, 10:22 pm EST

    Hello,

    Source collection is not changing

    We are sorry but we were not able to replicate the issue at our end. The sourceCollection property is being updated after dragging a row. Please refer to the sample:

    http://jsfiddle.net/0tmvbefn/

    In the above sample, you can use the ‘Show Source collection’ button to check the sourceCollection before and after dragging the row.

    Feel free to modify the sample depicting your issue so that we may investigate further.

    Save the dragged row index

    You can save the row index in the draggingRow event of Flexgrid. The event data has a property, row, which stores the index of the row currently being dragged. The provided sample also uses this property to update the data in the source collection.

    API reference:

    https://www.grapecity.com/wijmo/api/classes/wijmo_grid.cellrangeeventargs.html#row

    Rows remain at the same position after page refresh

    In order to achieve this behavior, you need to store updated data somewhere else and since Flexgrid is a client-side control, you can store the data in the local storage of the browser and then load it again when the page refreshes.

    Please refer to the sample below that demonstrates how to achieve the above behavior:

    http://jsfiddle.net/qx6vmhyz/

    Regards,

    Manish Gupta

  • Posted 23 June 2019, 7:45 pm EST

    Hi Team,

    i need support on one urgent query:

    while having selection mode as cellRange , can we have alternate row selection with ctrl + mouse selection, and ctrl + A , will select all the rows,

    with ctrl + mouse , i can select alternate rows, any custom method could be helpful here , which can be used with either Lisbox or cellRange selection mode.

  • Posted 24 June 2019, 7:35 pm EST

    Select using Ctrl + Mouse

    To select rows using Ctrl + Mouse, you will need to handle the mousedown event of FlexGrid and check if the Ctrl key is pressed and select the rows accordingly. Please refer to the sample below:

    https://stackblitz.com/edit/js-ccqncu

    Select All using Ctrl + A

    This behavior is implemented in FlexGrid by default. You can easily select all the rows by pressing Ctrl + A.

Need extra support?

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

Learn More

Forum Channels