X
X
xbcaax2015-05-03 10:03:35
JavaScript
xbcaax, 2015-05-03 10:03:35

How to properly load scripts through renderPartial in Yii?

There is a page to which the grid is rendered from another action. Scripts are loaded via a synchronous request, to which chrome throws a message to the console

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check xhr.spec.whatwg.org .


I removed the duplicate scripts when rendering, but jquery.yiigridview.js is loaded synchronously

$cs = Yii::app()->clientScript;
        $cs->scriptMap['jquery.js'] = false;
        $cs->scriptMap['jquery.ba-bbq.js'] = false;
        $this->renderPartial('listinggrid',array(
            'model'=>$model,
        ), false, true)


Question: Is there a nice way to avoid this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
matperez, 2015-05-03
@matperez

I once used such an extension for a similar task
https://github.com/nlac/nlsclientscript

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question