
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 );

			pager = function( pagingInfo, callback, args ) {

				var VO = { wpf_dup_token: +new Date() + Math.random() }
				
				, request = loading.data( "data-request" );
				
				args = args || {};

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

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

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

				request = $.ajax( {

					type: "POST",

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

					data: {
						name: ajaxOptions.serviceName,
						params: JSON.stringify( $.extend( {}, VO, ajaxOptions.params || {}, args.params || {} ) )
					}
				} )
					
				.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.concat( $G.getAddRows ? $G.getAddRows() : [] ) );

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

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

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

				return request;
			};

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

		return pager;
	};
} );


@@ -56,18 +56,345 @@
 rgs ) %7B%0A
+%0A
 %09%09
+if ( this.isGenius && this.isGenius() ) %7B%0A%09%09%0A%09%09%09var field = args.sortCol.field%0A%09%09%09%0A%09%09%09, dataView = this.getData();%0A%0A%09%09%09dataView.beginUpdate();%0A%0A%09%09%09dataView.sort( function( a, b ) %7B%0A%09%09%09%09var x = a%5B field %5D, y = b%5B field %5D;%0A%0A%09%09%09%09return (x === y ? 0 : (x %3E y ? 1 : -1));%0A%09%09%09%7D, args.sortAsc );%0A%0A%09%09%09dataView.endUpdate();%0A%09%09%7D%0A%09%09else 
 this.get
@@ -2732,13 +2732,12 @@
 r;%0A%09%7D;%0A%7D );%0A
-%0A

Update Remote.js