Gridview Not Refreshing Data

Hi everybody.

Can anybody help me? I am already very dissapointed by that. My Kartik GridView doesn’t refresh data on editable column submit. I went through all the details of Kartik’s posts and checked every possible documentation, and forum. Please help…Maybe the JavaScript is incorrect? Or the PJax setting? I followed Kartik’s instructions.

Here is my code.

[b]

<?php

echo GridView::widget([

'containerOptions' =&gt; ['id'=&gt;'cont1','style'=&gt;'overflow: auto'], 


'headerRowOptions'=&gt;['class'=&gt;'kartik-sheet-style'],


'filterRowOptions'=&gt;['class'=&gt;'kartik-sheet-style'],


'pjax' =&gt; true, 


'pjaxSettings' =&gt;


		   	[


		        'neverTimeout'=&gt;true,


		        'options'=&gt;['id'=&gt;'w0']


		    ],  





	


'dataProvider' =&gt; &#036;dataProvider,


'filterModel' =&gt; &#036;searchModel,


'showPageSummary'=&gt;true,





'columns'=&gt;

[

	[


	    'class'=&gt;'kartik&#092;grid&#092;SerialColumn',


	    'width'=&gt;'36px',


	    'header'=&gt;'Sorszám',


	    'pageSummary'=&gt;'Total'


	],


	


	[


	    'class'=&gt;'kartik&#092;grid&#092;EditableColumn',


	    'attribute'=&gt;'other_growing_costs',


	    'pageSummary'=&gt;true


	  


	


	],


	





.....some other columns

],

]); ?&gt;

<script>

 &#036;.pjax.reload({container:'#cont1'});

</script>[/b]

have u code in controller or not?

if yes then copy here.

Hi

Yes I did. Here you have:

/**

 * Lists all DirectMaterialCosts models.


 * @return mixed


 */


public function actionIndex()


{


    &#036;searchModel = new DirectMaterialCostsSearch();


    &#036;dataProvider = &#036;searchModel-&gt;search(Yii::&#036;app-&gt;request-&gt;getQueryParams());

// validate if there is a editable input saved via AJAX

if (Yii::&#036;app-&gt;request-&gt;post('hasEditable')) {


  


  


  


    // instantiate your model for saving


    &#036;DirectMaterialCosts = Yii::&#036;app-&gt;request-&gt;post('editableKey');


    &#036;model = DirectMaterialCosts::findOne(&#036;DirectMaterialCosts);





    // store a default json response as desired by editable


    &#036;out = Json::encode(['output'=&gt;'', 'message'=&gt;'']);





    // fetch the first entry in posted data (there should 


    // only be one entry anyway in this array for an 


    // editable submission)


    // - &#036;posted is the posted data for Book without any indexes


    // - &#036;post is the converted array for single model validation


    &#036;post = [];


    &#036;posted = current(&#036;_POST['DirectMaterialCosts']);


    &#036;post['DirectMaterialCosts'] = &#036;posted;





    // load model like any single model validation


    if (&#036;model-&gt;load(&#036;post)) {


        // can save model or do something before saving model


       


       


        &#036;model-&gt;save();





        // custom output to return to be displayed as the editable grid cell


        // data. Normally this is empty - whereby whatever value is edited by 


        // in the input by user is updated automatically.


        &#036;output = '';





        // specific use case where you need to validate a specific


        // editable column posted when you have more than one 


        // EditableColumn in the grid view. We evaluate here a 


        // check to see if buy_amount was posted for the Book model


        //if (isset(&#036;posted['buy_amount'])) {


          // &#036;output =  Yii::&#036;app-&gt;formatter-&gt;asDecimal(&#036;model-&gt;buy_amount, 2);


        //} 





        // similarly you can check if the name attribute was posted as well


        // if (isset(&#036;posted['name'])) {


        //   &#036;output =  ''; // process as you need


        // } 


        


         


        


        &#036;out = Json::encode(['output'=&gt;&#036;output, 'message'=&gt;'']);


    } 


    // return ajax json encoded response and exit


    echo &#036;out;


    return;


}








    return &#036;this-&gt;render('index', [


        'searchModel' =&gt; &#036;searchModel,


        'dataProvider' =&gt; &#036;dataProvider,


      


    ]);


}

in my view:

<?= GridView::widget([

    'dataProvider' =&gt; &#036;dataProvider,


    'filterModel' =&gt; &#036;searchModel,


    'columns' =&gt; [


        ['class' =&gt; 'yii&#092;grid&#092;SerialColumn'],








        'countryName',


        [


            'class'=&gt;'kartik&#092;grid&#092;EditableColumn',


            'attribute'=&gt;'countryName', 


            'vAlign'=&gt;'middle',


            'width'=&gt;'210px',


            'editableOptions'=&gt; [


            'header' =&gt; 'profile', 


            ],


         


        ],


        'extra1',


        ['class' =&gt; 'yii&#092;grid&#092;ActionColumn'],


    ],

]); ?>

and controller code is same as urs.

u can rectify by inspect element on link then go to network and u can see parameters.

Ok, will try…Thanks a lot.

have u used namespace in controller? if not then copy below line there.

use yii\helpers\Json;