
define( function() {

	var handleSort = function( e, args ) {
		this.getData().onPagingInfoChanged.notify( { doSearch: 1 } );
	};
	
	return function( $G, ajaxOptions, enable ) {
	
		/** All operations in server-side */
		var pager;

		if ( true === enable ) {

			var dataView, request, loading;

			if ( !ajaxOptions.serviceName ) {
				
				throw "Service name cann't be null";
			}

			dataView = $G.getData();
			loading = $( "<div class='slick-loading' style='display: none;'> <div class='slick-head-mask'> </div> </div>" );

			$( $G.getContainerNode() ).append( loading );

			/** In SCM the 'pageNum' start from 1, so you should specify an offset to patch it */
			pager = function( pagingInfo, offset, callback, args ) {

				var VO = { wpf_dup_token: +new Date() + Math.random() }
				
				, request = loading.data( "data-request" )
				, sortColumn = $G.getSortColumns()[ 0 ];
				
				offset = offset || 0;

				VO[ ajaxOptions.moduleName || (ajaxOptions.moduleName = "gridElement_kiss") ] 

					= JSON.stringify( $.extend( {}, {
				
						pageVO: {
							curPage: +pagingInfo.pageNum + offset,
							incrementalPaging: false,
							pageSize: +pagingInfo.pageSize,
							totalRows: -1
						}
					} ) );

				/** Keep one ajax instance */
				request && request.abort();

				request = $.ajax( {

					beforeSend: function() { 
						/** Show the loading */
						loading.fadeIn(); 
					},

					data: {
						name: ajaxOptions.serviceName,
						params: JSON.stringify( $.extend( {}, VO, args || {} ) )
					}
				} )
					
				.done( function( data ) {

					try {
						data = eval( "(" + data + ")" );
						data = data[ "result" ][ ajaxOptions.moduleName ];
						data = JSON.parse( data );

					} catch ( ex ) {
						
						throw "Call the service '" + ajaxOptions.serviceName + "' failed:\n" + ex;
					}

					dataView.setItems( data.result );

					/** Render all rows */
					$G.invalidate();

					with ( data.pageVO ) {
						callback( { pageNum: curPage - 1, pageSize: pageSize, totalPages: totalPages } );
					}
				} )
				
				.always( function() { 
					loading.removeData( "data-request" ).fadeOut( 100 ); 
				} );

				loading.data( "data-request", request );
			};

			/** Registe event handler */
			$G.onSort.subscribe( handleSort );
		} else {
			
			$G.onSort.unsubscribe( handleSort );
		}

		return pager;
	};
} );


@@ -840,52 +840,8 @@
 t%22 )
-%0A%09%09%09%09, sortColumn = $G.getSortColumns()%5B 0 %5D
 ;%0A%09%09
@@ -870,16 +870,40 @@
  %7C%7C 0;%0A%0A
+%09%09%09%09args = args %7C%7C %7B%7D;%0A%0A
 %09%09%09%09VO%5B 
@@ -1000,30 +1000,16 @@
 ringify(
- $.extend( %7B%7D,
  %7B%0A%09%09%09%09%0A
@@ -1021,16 +1021,30 @@
 %09pageVO:
+ $.extend( %7B%7D,
  %7B%0A%09%09%09%09%09
@@ -1188,17 +1188,36 @@
 %09%09%09%7D
+, args.pageVO %7C%7C %7B%7D )
 %0A%09%09%09%09%09%7D
- )
  );%0A
@@ -1502,24 +1502,31 @@
 %7B%7D, VO, args
+.params
  %7C%7C %7B%7D ) )%0A%09

Update Remote.js