JSFiddle - React, Tailwind, and code Playground

by valchev

HTML

<script src="http://cdn.kendostatic.com/2012.1.515/js/kendo.web.min.js"></script>
<link rel="stylesheet" href="http://cdn.kendostatic.com/2011.3.1129/styles/kendo.common.min.css">
<link rel="stylesheet" href="http://cdn.kendostatic.com/2011.3.1129/styles/kendo.default.min.css">
<link rel="stylesheet" href="http://cdn.kendostatic.com/2011.3.1129/styles/kendo.blueopal.min.css">
<div id="assignView"></div>
<br />
<br />
<div id="unassignView"></div>

<script type="text/x-kendo-tmpl" id="template">
    <div class="selection">
        <label>${Name}</label><label id="${ID}">X</label>
    </div>
</script>

CSS

.selection
        {
            float: left;
            margin: 2px;
            border-color: Black;
            border-width:  thin;
            border-style: solid;
            padding: 3px;
            
        }
        .selection label
        {
            margin: 2px;
         
        }

JavaScript

var data = [
    { ID: 1, Name: 'View' }, 
    { ID: 2, Name: 'Create' }, 
    { ID: 3, Name: 'Update' }, 
    { ID: 4, Name: 'Delete'}
];

var ds1 = new kendo.data.DataSource();
var ds2 = new kendo.data.DataSource();

function onDelete(e) {
    if (e) {
        var d = null;

        $(ds1.data()).each(function () {
            if(this.ID === parseInt(e.srcElement.id)){
                d = this;
            }
        });

        if (d) {
            ds1.remove(d);
            ds1.sync();
            ds2.add(d);
            ds2.sync();
        }
    }
};

function onChange(e){
    var task = e.sender.dataSource.view()[e.sender.select().index()];
    ds1.add(task);
    ds2.remove(task);
  
    var id = "#" + task.ID;
};

$(document).ready(function () {
    ds1.data([]);
    ds2.data(data);

    $("#assignView").kendoListView({
        dataSource: ds1,
        template: kendo.template($("#template").html())
    });

    $("#unassignView").kendoGrid({
        dataSource: ds2,
        change: onChange,
        selectable: "row"
    });

    $("#assignView").on('click', ".selection label[id]", onDelete);
});