locked
How to start with a blank list view as the destination for implementing drag and drop

    Question

  • Hi,

    I am trying to achieve drag and drop between 2 list views and followed this example "HTML ListView reorder and drag and drop sample" in the Windows 8.1 Samples with HTML and WinJS.

    In the sample application both the source and destination list views are identical (pointing to the same dataSource). And it is clear that when an item is added to the destination list view the dataSource changes and so the source list view updates itself to match the new dataSource.

    But in real business scenarios, most of the time the destination list view should be blank so that the user can add new items and that is captured. How can I start with a blank list view as the destination list view so that I can drag and drop to a empty list view. The number of items that is added to the destination list view will be used for my business logic.

    Also when dropping an item on the destination list view, what should be checked so that duplicates are not dropped. Can this be ignored when attempting to drop.

    Thanks,

    Rajesh

    Wednesday, November 20, 2013 1:02 PM

Answers

  • Hi,

    When designing a elegant business solution, most applications have 2 objects of the same type (the source and destination).

    That is why I asked about implementing 2 list views side by side (one full and the other empty) so that the user can drag and drop the items that he needs. That would give a clean artistic feel to the application.

    What would be the point in having a blank div as the drop target and then writing code again to populate another list view with the items that were dropped on the div. It makes it look clumsy.

    What I did for now is to create a list view and populate it with a single item that says "Drop items here" and that helps to achieve the result.

    Regards,

    Tuesday, November 26, 2013 4:20 AM

All replies

  • Doesn't Scenario 2 already start with a blank <div> that says "HTML 5 Drop Target"? You will need to implement your own functionality to prevent duplicates from being added.

    Windows Store Developer Solutions, follow us on Twitter: @WSDevSol|| Want more solutions? See our blog

    Thursday, November 21, 2013 12:50 AM
    Moderator
  • Hi,

    When designing a elegant business solution, most applications have 2 objects of the same type (the source and destination).

    That is why I asked about implementing 2 list views side by side (one full and the other empty) so that the user can drag and drop the items that he needs. That would give a clean artistic feel to the application.

    What would be the point in having a blank div as the drop target and then writing code again to populate another list view with the items that were dropped on the div. It makes it look clumsy.

    What I did for now is to create a list view and populate it with a single item that says "Drop items here" and that helps to achieve the result.

    Regards,

    Tuesday, November 26, 2013 4:20 AM