Kartik Editable Column Getting ID Through Function

Does anyone know if it’s possible to use a function to get the id of a model to perform an edit on the row?

Currently my grid view widget is setup like so:

echo GridView::widget([
'dataProvider' => $dataProvider3,
'columns' => [
...
'editableOptions' => [
'header' => 'Notes',
'inputType' => \kartik\editable\Editable::INPUT_TEXT,
'formOptions' => ['action' => ['application/edit']],
'pjaxContainerId' => 'permission',
'format' => 'button',
'options' => [
'pluginOptions' => [
]
],
...

My problem is the id sent to the edit is the id of the row. That is not the case for the id’s in my table. Is it possible to do something along the lines of:

> 'formOptions' => ['action' => ['application/edit'], 'id' => $model->id],

Or is that not possible?

If I’m understanding you right, you want change the destination of the edit button.

In Yii’s gridview, you would use ActionColumn in the column definition. I imagine its the same with Kartik’s.

GridView::widget([
    'columns' => [
        'id',
        'title',
        [
            'class' => 'yii\grid\ActionColumn',
            'urlCreator' => function( $action, $model, $key, $index ){
                if ($action === "view") {
                    return Url::to(['view', 'id' => $key]);
                }
                if ($action === "update") {
                    return Url::to(['someOtherModel/edit', 'id' => $key]);
                }
                if ($action === "delete") {
                    return Url::to(['delete', 'id' => $key]);
                }

            }
        ],
    ],
]);