A
A
alex995052017-10-26 09:58:58
Yii
alex99505, 2017-10-26 09:58:58

Why doesn't ArrayDataProvider pass id for edit?

I formatted the data from the database in the ArrayDataProvider, passed it to the widget, but the edit link does not pass the record id to the database, but the record index in the ArrayDataProvider array.
How can I specify that the right id is taken?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
alex99505, 2017-10-26
@alex99505

Everything, it turns out, is in the dock, I didn't read it)
To do this, you need to set 'key' => 'id' in ArrayDataProvider;

D
Dmitry Bay, 2017-10-26
@kawabanga

1) you can rewrite the button.
2) you can use indexBy('id')
3) I'm not sure, but doesn't the standard data provider eat an array?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question