Keith: thank you… I got an extension called yii-bootstrap-editable that I have tried but no changes in the back-ground and here are the sources:
<!--Generated using Gimme CRUD freeware from www.HandsOnCoding.net -->
<?php
Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
$('.search-form').toggle();
return false;
});
$('.search-form form').submit(function(){
$.fn.yiiGridView.update('readingbooksgrid', {
data: $(this).serialize()
});
return false;
});
");
?>
Reading Books for Period Group
<?php //echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
<div class="search-form" >
<?php $this->renderPartial('_search',array(
'model'=>$model,
)); ?>
</div><!-- search-form -->
<?php
$this->widget('bootstrap.widgets.TbGridView', array(
'id'=>'readingbooksgrid',
'itemsCssClass'=>'table table-striped table-bordered table-condensed',
// 'header'=>'my home is here ',
'dataProvider'=>$model->search(),
// 'filter'=>$model,
'columns'=>array(
// 'class' => 'ext.editable.EditableColumn',
// 'BillingGroupID',
// 'BillingMonth',
'contractno',
'firstname',
'previousreading',
array(
'class' => 'ext.editable.EditableColumn',
'name' => 'reading',
'headerHtmlOptions' => array('style' => 'width: 30px'),
'editable' => array(
'url' => $this->createUrl('readingbooks/update'),
'placement' => 'right',
'inputclass' => 'span3',
'params' => array('YII_CSRF_TOKEN' => Yii::app()->request->csrfToken),
)
),
array(
'class' => 'ext.editable.EditableColumn',
'name' => 'readingcode',
'headerHtmlOptions' => array('style' => 'width: 30px'),
'editable' => array(
'url' => $this->createUrl('meterreading/update'),
'placement' => 'right',
'inputclass' => 'span3',
)
),
// 'readingcode',
array(
'class' => 'ext.editable.EditableColumn',
'name' => 'dateofreading',
'headerHtmlOptions' => array('style' => 'width: 80px'),
'editable' => array(
'type' => 'date',
'url' => $this->createUrl('meterreading/update'),
'placement' => 'right',
'inputclass' => 'span3',
)
),
// 'dateofreading',
array(
'class' => 'ext.editable.EditableColumn',
'name' => 'meterreaderid',
'headerHtmlOptions' => array('style' => 'width: 70px'),
'editable' => array(
'type' => 'select',
'url' => $this->createUrl('meterreading/update'),
'placement' => 'right',
'inputclass' => 'span3',
'source'=>CHtml::listData(Meterreader::model()->findAll(),'ID','FirstName'),
'onRender' => 'js: function(e, editable) { var colors = {1: "green", 2: "blue", 3: "red", 4: "gray"};
$(this).css("color", colors[editable.value]); }',
// 'source' => array(0 => 'Male', 1 => 'Female'),
)
),
// 'meterreaderid',
array(
'class' => 'ext.editable.EditableColumn',
'name' => 'readingcomments',
'headerHtmlOptions' => array('style' => 'width: 110px'),
'editable' => array(
'type' => 'textarea',
'url' => $this->createUrl('meterreading/update'),
'placement' => 'right',
'inputclass' => 'span3',
)
),
// 'readingcomments',
// 'consumptionforbilling',
'avgconsumption',
array(
'class'=>'CButtonColumn',
'template'=>'',
'buttons'=>array
(
),
),
),
)); ?>
Controller Action
public function actionUpdate($CustomerID, $BillingMonth)
{
Yii::import('ext.editable.EditableSaver'); //or you can add import 'ext.editable.*' to config
$es = new EditableSaver('Readings'); // 'MeterReading' is classname of model to be updated
$es->onBeforeUpdate = function($event) {
$event->sender->setAttribute('Reading',$this->readingcode);
};
try {
$es->update();
} catch(CException $e) {
echo CJSON::encode(array('success' => false, 'msg' => $e->getMessage()));
return;
}
echo CJSON::encode(array('success' => true));
}
Still no solution