JSFiddle - React, Tailwind, and code Playground

by JanGous

HTML

<script src="http://knockoutjs.com/js/knockout-2.2.0.js"></script>
<Table border="1" cellpadding="5" cellspacing="0">
    <thead>
        <tr>
            <td>Button</td>
            <td>Value</td>
        </tr>
    </thead>
    <tbody data-bind="foreach: myarray">
        <tr>
            <td>
                <input type="button" value="Change" data-bind="click: $root.editclick" />
            </td>
            <td><span data-bind="text: enabled" />
            </td>
        </tr>
    </tbody>
</Table>

JavaScript

var myViewModel = {
     myarray: ko.observableArray([{
         myname: 'Bob',
         mysurname: 'Smith',
         enabled: false
     }, {
         myname: 'John',
         mysurname: 'Smith',
         enabled: false
     }]),
     editclick: function (user) {
         user.enabled = true;
         alert(ko.toJSON(user));
         return true;
     }
 };

$(document).ready(function () {
            //Bind View model
            ko.applyBindings(myViewModel);
        });