This question although general come from the fact that I’m trying to use Kartik’s Export extension from my index view to export what is display in the gridview. The issue I’m facing is the fact that the gridview displays content from a main table (projects), but also related tables. Now I did manage to create similar attribute in the Export columns, but there are issues in the output formatting.
Long story short, I thought I could create a seperate dataProvider just for the Export to resolve this, but am struggling. The basic search model is
public function search($params)
{
$this->load($params);
$query = Projects::find();
$query->leftJoin('projects_legs','projects.ProjId=projects_legs.ProjId');
and this gives
SELECT `projects`.* FROM `projects` LEFT JOIN `projects_legs` ON `projects`.`ProjId` = `projects_legs`.`ProjId`
But I’m looking for (addtion of projects_legs
.*)
SELECT `projects`.*, `projects_legs`.* FROM `projects` LEFT JOIN `projects_legs` ON `projects`.`ProjId` = `projects_legs`.`ProjId`
How would I modify the search function to achieve that? Once I have that I should be good.