Knockout Subscribe

by gurkavcu

HTML

<script src="http://rniemeyer.github.com/KnockMeOut/Scripts/jquery.tmpl.js"></script>
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<script src="https://raw.github.com/SteveSanderson/knockout/master/build/output/knockout-latest.debug.js"></script>
<script src="https://raw.github.com/SteveSanderson/knockout.mapping/master/build/output/knockout.mapping-latest.js"></script>
<script src="https://raw.github.com/ericmbarnard/Knockout-Validation/master/Src/knockout.validation.js"></script>
<input data-bind="value:test" required/>

<input data-bind="value:markaViewModel.selectedMarka().marka" />
<button type="button" class="btn btn-primary" data-bind="click:markaViewModel.markaSave">KAYDET</button> 
<button type="button" class="btn btn-primary" >VAZGEÇ</button>


<table class="table table-striped table-hover">
    <thead>
        <tr>
            <th>Marka</th>
            <th class="w100 tcenter">İşlemler</th>
        </tr>
    </thead>
    <tbody data-bind="foreach : markaViewModel.markaListesi">
        <tr>
            <td data-bind="click: $parent.markaViewModel.modelLoad, text: marka" class="markaClicks"></td>
            <td>
                <div class="controls center">
                    <a href="#" title="Kayıt Düzenle" class="tip clickLink" rel="editBrand"><span class="icon12 icomoon-icon-pencil"></span></a>
                    <a href="#modalDel" title="Kayıt Sil" class="tip deleteLink" data-toggle="modal"><span class="icon12 icomoon-icon-remove"></span></a>
                </div>                                
            </td>
        </tr>                        
    </tbody>
</table>

JavaScript

var markaJson = JSON.parse('[{\"marka\":\"AUDI\",\"id\":19,\"version\":0,\"eklendi\":\"Oct 5, 2012 5:24:48 PM\",\"ekleyen\":-1,\"degistiren\":0},{\"marka\":\"BABAZOLLA\",\"id\":20,\"version\":0,\"eklendi\":\"Oct 5, 2012 5:27:58 PM\",\"ekleyen\":-1,\"degistiren\":0},{\"marka\":\"BMW\",\"id\":18,\"version\":0,\"eklendi\":\"Oct 5, 2012 5:20:58 PM\",\"ekleyen\":-1,\"degistiren\":0},{\"marka\":\"CCCCC\",\"id\":30,\"version\":0,\"eklendi\":\"Oct 5, 2012 6:28:56 PM\",\"ekleyen\":-1,\"degistiren\":0},{\"marka\":\"FORD\",\"id\":7,\"version\":0,\"eklendi\":\"Oct 5, 2012 3:55:17 PM\",\"ekleyen\":-1,\"degistiren\":0},{\"marka\":\"HYUNDAI\",\"id\":5,\"version\":0,\"eklendi\":\"Oct 5, 2012 3:55:17 PM\",\"ekleyen\":-1,\"degistiren\":0},{\"marka\":\"ISUZU\",\"id\":6,\"version\":0,\"eklendi\":\"Oct 5, 2012 3:55:17 PM\",\"ekleyen\":-1,\"degistiren\":0},{\"marka\":\"KARAVAN\",\"id\":21,\"version\":0,\"eklendi\":\"Oct 5, 2012 5:28:10 PM\",\"ekleyen\":-1,\"degistiren\":0},{\"marka\":\"LADA\",\"id\":17,\"version\":0,\"eklendi\":\"Oct 5, 2012 5:19:51 PM\",\"ekleyen\":-1,\"degistiren\":0},{\"marka\":\"MERCEDES\",\"id\":8,\"version\":0,\"eklendi\":\"Oct 5, 2012 3:55:17 PM\",\"ekleyen\":-1,\"degistiren\":0},{\"marka\":\"RENAULT\",\"id\":4,\"version\":0,\"eklendi\":\"Oct 5, 2012 3:55:17 PM\",\"ekleyen\":-1,\"degistiren\":0},{\"marka\":\"TOYOTA\",\"id\":9,\"version\":0,\"eklendi\":\"Oct 5, 2012 3:55:17 PM\",\"ekleyen\":-1,\"degistiren\":0},{\"marka\":\"aaaaaa\",\"id\":29,\"version\":0,\"eklendi\":\"Oct 5, 2012 6:21:22 PM\",\"ekleyen\":-1,\"degistiren\":0},{\"marka\":\"dsgsdf\",\"id\":33,\"version\":0,\"eklendi\":\"Oct 5, 2012 6:42:09 PM\",\"ekleyen\":-1,\"degistiren\":0},{\"marka\":\"erertertertert\",\"id\":27,\"version\":0,\"eklendi\":\"Oct 5, 2012 6:12:32 PM\",\"ekleyen\":-1,\"degistiren\":0},{\"marka\":\"sdrtsdrtsertsdrt\",\"id\":26,\"version\":0,\"eklendi\":\"Oct 5, 2012 6:11:41 PM\",\"ekleyen\":-1,\"degistiren\":0}]');

var modelJson =...