Text Field Input in GridView

Hallo, I have view interface like image below , so what property should I use to create text field in New activity column?

Is it possible place input text field inside GridView ? I use GridView::widget .

I have read the documentation here http://www.yiiframework.com/doc-2.0/yii-grid-column.html

but still no idea


1 Like

Of course it is easily possible, just create class that extends DataColumn, and use it as one of your columns,


     class => '\YourNamespace\YourClass'


And you will need some code to handle request data.


I think that maybe this can help you.

GrindView Editable


stil no idea how to extends DataColumn,

my code like this

[‘class’ => ‘yii\grid\DataColumn’,

         'label' => 'New Activity',


the new activity column still not change to input text .

datacolumn is used to show data columns and allows sorting and filtering them ?

how it can change the column type ?

I ment you should use class inheritance. If you do not know what is it you defently should learn this concept.

Are you mean like this ?


  'value' =>

    function(){   return Html::textInput('', ''); },

   'attribute' => 'new_activity',

    'format' => 'raw',


Just want to know, if there is another method ?

look at this link http://www.yiiframework.com/wiki/353/working-with-cgridview-in-admin-panel/