Answer the question
In order to leave comments, you need to log in
Why does kartik editable return different post index?
Method in controller:
$CallsMaindata = Yii::$app->request->post('CallsMaindata');
$id = Yii::$app->request->post('editableKey');
$model = CallsMaindata::find()->where(['id' => $id])->one();
if(is_array($CallsMaindata)){
foreach ($CallsMaindata as $callsMaindatum) {
$model->call_status = $callsMaindatum['call_status'];
break;
}
}
Answer the question
In order to leave comments, you need to log in
most likely the index contains the line number (or something similar).
You can get rid of the loop by using the reset function, for example:
$callsMaindatum = reset($CallsMaindata);
$model->call_status = $callsMaindatum['call_status'];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question