file location is: yiiroot/framework/widjets/assets/gridview/jquery.yiigridview.js
I need to change one line in this file so that I can use it in my requirements.
//original code line 79,80
if (settings.ajaxUpdate.length > 0) {
$(document).on('click.yiiGridView', settings.updateSelector, function () {
//I need to change it to :
if (settings.ajaxUpdate.length > 0) {
$(this).parent().on('click.yiiGridView', settings.updateSelector, function () {
what is the right way to override this without needing to change the source code file?
An alternate method to do this would be to use jQuery’s
offmethod.Using
offyou can remove the event handler that is already added in jquery.yiigridview.js, and then add a new handler usingon.Something like this(in the view that has the grid view):
Read on about the
onmethod too to get a better understanding of the code.Note:
Take care that the event namespace i.e
click.yiiGridViewis correct, actually in the version of yii i have there is no namespace and it is justclick, so check that before overriding.