Note that there are some explanatory texts on larger screens.

plurals
  1. POOverride a private JS method in Yii Grid View
    primarykey
    data
    text
    <p>I'd like to extend a function in the <code>YiiGridView</code> plugin at <code>yii\framework\zii\widgets\assets\gridview\jquery.yiigridview.js</code> to add data to the ajax call made by the plugin.</p> <p>Full source for plugin file can be viewed at: <a href="https://code.google.com/p/yii/source/browse/trunk/framework/zii/widgets/assets/gridview/jquery.yiigridview.js" rel="nofollow">https://code.google.com/p/yii/source/browse/trunk/framework/zii/widgets/assets/gridview/jquery.yiigridview.js</a></p> <p>The following are the solutions I have come upon:</p> <p><strong>Solutions</strong></p> <ol> <li><p>At the moment, I'm using ScriptMap as indicated here: <a href="http://www.yiiframework.com/forum/index.php/topic/31530-override-jqueryyiigridviewjs/" rel="nofollow">http://www.yiiframework.com/forum/index.php/topic/31530-override-jqueryyiigridviewjs/</a></p></li> <li><p>I can also opt to use ajaxSend global event to add my own data to every request sent: <a href="http://api.jquery.com/ajaxSend/" rel="nofollow">http://api.jquery.com/ajaxSend/</a></p></li> <li><p>Other methods that indicate that such a functionality can be achieved by overriding <code>$.fn.yiiGridView.update</code> function do not apply because as of <code>Yii 1.1.9</code> such methods are deprecated.</p></li> </ol> <p><strong>Question</strong></p> <p>What I'd like to achieve is change:</p> <pre><code>$.ajax(options); </code></pre> <p>to:</p> <pre><code>options = $.extend({}, options, {data: myCustomData}); $.ajax(options); </code></pre> <p>without having to resort to methods 1, 2 or 3. If this is not possible I'd like confirmation of that.</p> <p>Line number 270 in the plugin file at: <a href="https://code.google.com/p/yii/source/browse/trunk/framework/zii/widgets/assets/gridview/jquery.yiigridview.js#270" rel="nofollow">https://code.google.com/p/yii/source/browse/trunk/framework/zii/widgets/assets/gridview/jquery.yiigridview.js#270</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload