I have face with this error while creat grid seriallize render data inside Grid parent. It build in by Grid UI Component. I dont use old way like magento 1. When click on edit tab to trigger ajax render grid. Console rise undefined JSObject. How to fix it and define missing object? Why it could happen

grid render by component grid follow path below but i don't understand it fully



I found my problem. Somehow GridJsObject missing because template not render successful.
In Magento 2 grid in backend render by grid.js widget.
Location of file in lib\web\mage\adminhtml\grid.js. File vendor\magento\module-backend\view\adminhtml\templates\widget\grid.phtml responsibility for render template. Inside this template you will find

deps.push('mage/adminhtml/grid'); for call widget

This line in 164-187 for creat GridJsObject by Object varienGrid

<?php /* @escapeNotVerified */ echo $block->getJsObjectName() ?> = new varienGrid('<?php echo $block->escapeHtml($block->getId()) ?>', '<?php /* @escapeNotVerified */ echo $block->getGridUrl() ?>', '<?php /* @escapeNotVerified */ echo $block->getVarNamePage() ?>', '<?php /* @escapeNotVerified */ echo $block->getVarNameSort() ?>', '<?php /* @escapeNotVerified */ echo $block->getVarNameDir() ?>', '<?php /* @escapeNotVerified */ echo $block->getVarNameFilter() ?>');

Grid missing by template not render

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.