Prevent Listview updates

This will prevent ListView’s from firing updates when the user clicks on the pager’s disabled or active links. Useful when you have a fancy effect, like an overlay with an animated gif, to transition to the new result set.

You’ll probably want to copy jquery.yiilistview.js to a new location, modify it, and point to the script file OR extend CListView and change baseScriptFile to point to the new file.





    $.fn.yiiListView = function(options) {

        return this.each(function(){

            var settings = $.extend({}, $.fn.yiiListView.defaults, options || {});

            var $this = $(this);

            var id = $this.attr('id');

            if(settings.updateSelector == undefined) {

                settings.updateSelector = '#'+id+' .'+settings.pagerClass.replace(/\s+/g,'.')+' a, #'+id+' .'+settings.sorterClass.replace(/\s+/g,'.')+' a';

            }

            $.fn.yiiListView.settings[id] = settings;


            if(settings.ajaxUpdate.length > 0) {

                $(settings.updateSelector).die('click').live('click',function(){

	    	

                    // HERE!!!

                    // HERE!!!

                    // HERE!!! 

                    // Prevents disabled or active class from firing the ajax update

                    if ($(this).parent().is('.disabled, .active')) {

                        return false;

                    }          

          

                    $.fn.yiiListView.update(id, {

                        url: $(this).attr('href')

                    });

                    return false;

                });

            }

        });

    };



Matt

OR you can just override original function with own version - create another js file and include it after the original list view script. In your script you can replace function with your version:




...

$.fn.yiiListView = function(options) { //my version }

//my other code