Answer the question
In order to leave comments, you need to log in
Yii2 GridView :: how to style multidimensional array in ArrayDataprovider?
Lord, hello.
The data is stored in the EAV model, the data is pulled out into a two-dimensional array:
result = [
post_title = [id, value],
weght = [id, value],
cost = [id, value]
]
How to present this array to the ActiveDataProvider so that the GridView accepts it and displayed three columns with names (post_title, weight, cost) ?
If you specify a "raw" array, it generates the error "array_merge(): Argument #2 is not an array".
Thank you in advance for your help!
Answer the question
In order to leave comments, you need to log in
Gentlemen, the solution turned out when the multidimensional array was converted into a one-dimensional array (with four columns):
foreach ($argh as $key => $value) {
foreach ($value as $inkey => $inval) {
$result[$i][$key] = $inval;
$i++;
}
$i = 0;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question