Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gridview Update after update select value #3

Closed
milansuthar811 opened this issue Jul 25, 2017 · 11 comments
Closed

Gridview Update after update select value #3

milansuthar811 opened this issue Jul 25, 2017 · 11 comments

Comments

@milansuthar811
Copy link

Gridview Update after update select value not working

@ihorchepurnyi
Copy link
Contributor

Can you please describe more detail your issue?

@milansuthar811
Copy link
Author

[ 'header' => DidmasterModule::t('didmaster', 'Service'), 'class' => EditableColumn::className(), 'attribute' => 'serviceName.serv_name', 'url' => '/didmaster/didtenant/get-services', 'type' => 'select', 'editableOptions' => function ($model) { return [ 'source' => ArrayHelper::map(ServiceMaster::getServicePackages(), 'serv_id', 'serv_name'), 'value' => $model->sv_id, ]; }, ],

Above is my code.
When I called 'get-services()' method and get complete operation with success, I need to reload my Grid.

@ihorchepurnyi
Copy link
Contributor

Ok, I check it later

@milansuthar811
Copy link
Author

@igor-chepurnoi are you understand my problem?

@ihorchepurnyi
Copy link
Contributor

ihorchepurnyi commented Jul 25, 2017

Yes, As I understand, you need to reload gridview after value has been saved, right?

After editable ajax request has been completed.

@milansuthar811
Copy link
Author

@igor-chepurnoi Yes, I need to reload gridview after value has been saved. Please help me in it.
Thanking you.

@ihorchepurnyi
Copy link
Contributor

Ok, I'll try to help.

@ihorchepurnyi
Copy link
Contributor

ihorchepurnyi commented Jul 25, 2017

I have updated this package, please update the package to dev-master version, and use the following code for update your gridview

You need to define clientOptions array with success callback

Grid view example

<?php Pjax::begin(['timeout' => 10000, 'options' => ['id' => 'grid-pjax-container']]); ?>
    <?php echo GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            [
                'class' => EditableColumn::class,
                'attribute' => 'username',
                'url' => ['edit-user'],
                'clientOptions' => [
                    'success' => (new \yii\web\JsExpression('function() {
                        $.pjax.reload({container: "#grid-pjax-container"}); // this code for update grid
                    }'))
                ],
            ],
            [
                'header' => Yii::t('app', 'Action'),
                'class' => 'yii\grid\ActionColumn',
                'template' => '{update} {delete}',
            ],
        ],
    ]);
    ?>
    <?php Pjax::end(); ?>

@milansuthar811
Copy link
Author

milansuthar811 commented Jul 26, 2017

thanks @igor-chepurnoi,
i tried it but its giving following exception
Setting unknown property: yii2mod\editable\EditableColumn::clientOptions

@ihorchepurnyi
Copy link
Contributor

ihorchepurnyi commented Jul 26, 2017

You need to update yii2mod/yii2-editable package via command composer update, set version to dev-master

@milansuthar811
Copy link
Author

Thanks @igor-chepurnoi .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants