Remove/Add

4 posts, 1 answers
  1. Voss
    Voss avatar
    11 posts
    Member since:
    Jul 2014

    Posted 15 Aug 2014 Link to this post

    I've seen some similar posts, but not exactly what I need.

    I have two ListViews

    Items can be dragged and dropped between them.

    I need to be able to remove the dragged item from one list and add it to the other list.

    This is how the ListView is created.

    <div id="serversAll">
                <div data-role="scroller" style="background-color: gray; height: 300px; width: 370px; padding-top: 13px; padding-bottom: 17px;">
                    <table data-bind="source: serversAll" data-template="templateServers" class="servers"></table>
                </div>
            </div>

    var vmSevers = kendo.observable({
           isVisible: true,
           serversAll: new kendo.data.DataSource({
               schema: {
                   model: {
                       id: "Id"
                   }
               },
               batch: false,
               transport: {
                   read: {
                       url: url
                   }
               }
           })
       });

       kendo.bind($("#serversAll"), vmSevers, kendo.mobile.ui);
  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 19 Aug 2014 Link to this post

    Hi Voss,

    Please check this help topic as it explains how to achieve such scenario using Kendo Drag & Drop events and DataSource API

    Regards,
    Alexander Valchev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Voss
    Voss avatar
    11 posts
    Member since:
    Jul 2014

    Posted 19 Aug 2014 in reply to Alexander Valchev Link to this post

    I can't get the:
    dataItem = listA_DS.getByUid(draggableElement.data("uid"));

    to work on my example. Your sample works in the dojo. Is there something I need to do extra to generate the uid?

    thanks.
  5. Answer
    Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 20 Aug 2014 Link to this post

    Hello Voss,

    The DataSource automatically generates uid for every record. You should manually add it in the template (templateServers).

    <script type="text/x-kendo-template" id="templateServers">
      <tr data-uid="#:uid#">
        (...)
      </tr>
    </script>


    Regards,
    Alexander Valchev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready