Edit cell of GridView

Hi everybody, I want to edit a cell of the GridView,

I have this:

The model:


public function getInputField($fieldName) {

  return CActiveForm::textField($this,$fieldName,array("name"=>"form_name[".$fieldName."][" .$this->Id . "]"));

    }

The grid:


'columns'=>array(

   array('name'=>"theFieldName",

         'type'=>'raw',

         'value'=>'$data->getInputField(\'theFieldName\')'),

But, How can I save the value in the input fields??

Because I want to complete the Fields and the submit it

Thanks you very much.!!

You have placed input field in grid view, but just changing input field value won’t save it in DB. I suppose you could add some button with attached js that will fire request to server, but in this case I would use editable, check those :

https://vitalets.github.io/x-editable/

or

http://www.appelsiini.net/projects/jeditable

1 Like