
define( [ "slick/paging/Paging",
	"slick/plugins/Radiocolumn",
	"self/common/ui/Amodal" ], function( Paging, Radiocolumn ) {

	var openDialog = function( options ) {

	
		$.amodal( {
			
			title: options.title || "Dialog",
			showButtons: false,
			closeByDocument: true,

			css: options.css || { width: 800 },

			render: function( ready, loading, close ) {
				
				var $G;

				this
				.html( "<section class='slick-dialog-head'>" + 
						"<input type='text' name='sometext' placeholder='Please enter search keywrods'>" +
						"<button name='search'>Search</button>" +
						"<button name='filter'>Filter</button>" +
					"</section>" +
					"<section class='slick-dialog-body'>" +
						"<div class='slick-wrap fade out' style='width:100%;'>" +
							"<div style='width:100%;height:410px;'></div>" +
						"</div>" +
					"</section>" +
					"<sction class='slick-dialog-tail'>" + 
						"<button name='amodal-ok'>Ok</button>" +
						"<button name='amodal-cancel'>Cancel</button>" +
					"</section>" );
				
				window.$DG = $G = new Slick.Grid( this.find( ".slick-wrap > div:first" ), new Slick.Data.DataView(), [], {
					
					/** Enable keybord navigation */
					enableCellNavigation: true,

					/** Fast keybord navigation */
					asyncEditorLoading: true,

					/** No horizontal scroll */
					forceFitColumns: false,

					/** Filter bar */
					showHeaderRow: true,

					/** Need init() */
					explicitInitialization: true
				} );

				$G.setColumns( [ Radiocolumn( $G ) ].concat( options.columns ) );

				Paging( $G, $G.getData(), {
				
					pagingInfo: {
						pageSize: 1000,
						pageNum: 0,

						sizes: [ 1000, 5000, 10000, 50000 ]
					},

					ajaxOptions: options.ajaxOptions || {
					
						serviceName: "queryPorject",
						moduleName: "gridElement_publicfind",
						params: {
							"entityId": 0,
							"popUpProgramName": "mrCreateCustomer"
						}
					}
				} );

				$G.init();

				$G.onDblClick.subscribe( function( e ) {
					options._onOk( $G.getRadioRow(), close() );
					e.stopImmediatePropagation();
				} );

				this

				.delegate( "button[name=search]", "click", function() {
					$G.search();
				} )

				.delegate( "button[name=filter]", "click", function() {
					/** Toggle filter bar */
					$G.setHeaderRowVisibility( !$( $G.getHeaderRow() ).is( ":visible" ) );
				} )

				.delegate( "button[name=amodal-ok]", "click", function() {
				
					options._onOk( $G.getRadioRow(), close() );
				} )

				.delegate( "button[name=amodal-cancle]", "click", function() {
				
					close();
				} )

				.find( ".slick-wrap" ).removeClass( "out" );

				ready.resolve();
			}
		} );
	}
	
	, DialogEditor = function( args ) {
	
		var
		  input,
		  trigger,
		  defaultValue;

		$.extend( this, {
			
			init: function() {

				var options = $.extend( {}, args.column.editorArgs || {}, {
					
					_onOk: function( item ) {
						this.onOk.apply( input, arguments );
						input.focus();
					},

				    	_onClose: function( item ) {
				    	
				    	}
				} );

				input = $( "<INPUT type=text class='editor-text dialog' /><small class='dialog-trigger' />" )
					.appendTo( args.container ).first().focus();

				trigger = input.next()
					.on( "click", function( e ) { openDialog( options ); } );
			},

			destroy: function() {
				
				input.add( trigger ).remove();
			},

			loadValue: function( item ) {
			
				input.val( defaultValue = item[ args.column.field ] ).focus();
			},

			serializeValue: function() {
				return input.val();
			},

			applyValue: function( item, state ) {
				item[ args.column.field ] = state;
			},

			isValueChanged: function() {
				
				/** Fuzzy match */
				return defaultValue != input.val();
			},

			validate: function( item, column ) {
			
				if ( args.column.validator ) {
					
					return args.column.validator( input.val(), item, column );
				}

				return {
					
					valid: true,
					msg: ""
				};
			}
		} );


		this.init();
	};

	return DialogEditor;
} );

@@ -161,18 +161,16 @@
 ns ) %7B%0A%0A
-%09%0A
 %09%09$.amod
@@ -1020,21 +1020,8 @@
 %09%09%09%09
-window.$DG = 
 $G =
@@ -2114,24 +2114,25 @@
 unction() %7B%0A
+%0A
 %09%09%09%09%09$G.sear
@@ -2134,16 +2134,75 @@
 .search(
+ %7B%0A%09%09%09%09%09%09params: %7B %22find%22: $( this ).prev().val() %7D%0A%09%09%09%09%09%7D 
 );%0A%09%09%09%09%7D

Update Dialog.js