1

I have created a custom grid associated with a tab.

Now the grid work well, there is an issue with ajax call.

The Ajax call hit the right url and the content is correctly displayed ( onSuccess state ) anyway for some reason the onCompleate state is never reached and so the loader continue to load.

The layout looks correct, I'm not sure what to check.

any suggestion ?

Note: I think, I am correctly using the getGridUrl() function in the tab since the grid content, on the ajax call, is retrieved and delivered on the page ...

  • what code you have try please update – Keyul Shah Dec 30 '14 at 8:37
  • I found out ... – Fra Dec 30 '14 at 14:51
3

General Debug with Ajax and Grid:
The fact that the onComplete state is not hit point out that there is some error triggered by the js. In the backend the ajax loader is managed by the js varienLoader class ( file loader.js ), in particular you may want to look into the respondToReadyState method.

My issue:
After some investigation I found out respondToReadyState (loader.js) was catching an exception Cannot read the property down of null
The exception what triggered by bindFieldsChange method (grid.js) and the reason was that the grid Id of the ajax call was different from the expected one.

I was not able to understand the exact reason because of this, anyway the solution for me was to change the tab class:
-> before I was extending directly the grid class
-> now I'm extending Mage_Adminhtml_Block_Widget

  • 1
    For future readers, the answer here doesn't go deep enough to solve the issue. Depending on your implementation, when using as an AJAX-based grid, you should set the id property of the grid block within the constructor; eg: $this->setId('grid_block_id'); The reason for JS failure as noted above is caused by a mismatched ID; that, when not explicitly set on a grid block, it will be autogenerated via uniqid. See parent method Mage_Adminhtml_Block_Widget::getId. The binding JS will now be able to locate your table on reload. – Rick Buczynski May 2 '16 at 0:31
  • Feel free to improve the answer ... – Fra May 2 '16 at 4:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.