Kartik ExportMenu CRAZY Situation

Hi all, i have a very crazy situation and i don’t know how to solve it.

I have one controller with two action ACT1 and ACT2.

In each action i load an ActiveDataProvider from two different model DataProvider1 on ACT1 and DataProvider2 on ACT2.

Each action open a view with a kartik gridview with exportmenu.



Extract in excel in the gridview1 work fine in each type (csv,text,excel 95+,excel 2007+).

My problem is on gridview2 that when i extract in excel (both 95+ and 2007+) i can’t open the file in Excel with the error “the format and the extension of the file are different”.

OK but what is the crazy situation?

To solve my problem i make a test:

In the ACT1 i create also the DataProvider2 but i leave it in the controller, i don’t render DataProvider2 to View1.

Simply $dataProvider2 = $searchModel2->search(); in the controller action1

The crazy situation is that with this instruction, now the GridView1 extraction give me error. I remove this instruction in the ACT1 and now the GridView1 works.

But in the ACT1 i don’t send DataProvider2 to the view1 as parameter. I simply load the search method.

Why this instruction in the controller, can broke kartik ExportMenu in the view1?

I tell you another time. In the view1 i only have DataProvider1 and not DataProvider2. Only for a test i load the DataProvider2 in the ACT1 of the controller.

It’s possible that for some reason the export process run out of memory so the excel file generated is broken?

Please give me any suggestion.


I think that you have some error (or warning) when instantiate $dataProvider1 and this error enters in excel export.

I would try to show content of $dataProvider1, in controller or views, using:



If this works file, I would check server log to see if there are erorrs there.

Thank’s Fabrizio.

DataProvider works fine because i see well it, in the GridView. Only the excel export generate wrong file. Other extraction in .csv and .html are OK. But is surely something in this DataProvider that broke in some way the export.

I do another test in my localhost to see also with YiiDebug if there’s some error, but nothing.

On the server also i don’t have any error message.

Very strange isssue…

EDIT: i find a light far far in the tunnel. This DataProvider is VERY-BIG because join 3 big table. Sure the big dimension are not a problem in the GridView that use pagination. But sure the excel-export process goes out of memory, or similar during file excel creation.

Checking var_dump as you suggest i see that DataProvider is 100MBytes!

I think you should change memory limit in php.ini.