Quentinb
(Quentin)
1
Hi,
I have a number of records in a database table with 6 columns.
I need to display the records as textfield(1 for each column) rows so a user can change it and then submit it all back to update the database.
What would be a good/best solution for this?
Query and loop the data building the textfields or is there something else I can use?
Thanks
Rom
(Rokorolov)
2
Hi,
public function actionUpdate()
{
$settings = Setting::find()->indexBy('id')->all();
if (Model::loadMultiple($settings, Yii::$app->request->post()) && Model::validateMultiple($settings)) {
foreach ($settings as $setting) {
$setting->save(false);
}
return $this->redirect('index');
}
return $this->render('update', ['settings' => $settings]);
}
http://www.yiiframework.com/doc-2.0/guide-input-tabular-input.html
There is an extension to do inline editing. Also, one to do tabular editing
Quentinb
(Quentin)
5
Thank you, I will also have a look at those ones.