<script>
    $('.write').click(function () {

        var readCheckBox = $(this).parent().parent().find('.read');
        var readHiddenId = this.id.replace('write', 'read');
        var hiddenField = $('#' + readHiddenId);
        var isChecked = $(this).is(':checked');

        if ($(this).attr('data-isPreset') === 'true') {
            isChecked = !isChecked;
            $(this).removeAttr('data-isPreset');
        }
        if ($(this).attr('data-isSelf') === 'true') {
            isChecked = !isChecked;
            $(this).removeAttr('data-isSelf');
        }

        if (readCheckBox.attr('data-isPreset') !== 'true') {
            if (isChecked) {
                readCheckBox.attr("disabled", true);
            } else {
                readCheckBox.removeAttr("disabled");
            }
            readCheckBox.attr('checked', isChecked);
        }
    });
</script>

<?php
$addressBookModel = Addressbook::model()->search();

// Get rawData and create dataProvider
$rawData = Addressbook::model()->findAll();
$dataProvider = new CArrayDataProvider($rawData, array('pagination' => false,));

//allAddressBooksProvider
$this->widget('bootstrap.widgets.TbGridView', array(
    'id' => 'addressbook-permissions-grid-update',
    'enableHistory' => false,
    'type' => 'striped bordered condensed',
    'itemsCssClass' => 'plTable',
    'dataProvider' => Addressbook::model()->allAddressBooksProvider(),
    'summaryText' => false,
    'columns' => $model->getColumns('addressbooks')
));
