function createDialog() {
			var dialog,
				originalValue,
				dialogSearchField,
				customHeader,
				closeButton;

			// use sap.ui.require to avoid circular dependency between the SearchField and Suggest
			dialogSearchField = new (sap.ui.require('sap/m/SearchField'))({
				liveChange : function (oEvent) {
					var value = oEvent.getParameter("newValue");
					oInput.setValue(value);
					oInput.fireLiveChange({newValue: value});
					oInput.fireSuggest({suggestValue: value});
					self.update();
				},
				search : function (oEvent) {
					if (!oEvent.getParameter("clearButtonPressed")) {
						dialog.close();
					}
				}
			});

			customHeader = new Bar({
				contentLeft: dialogSearchField
			});

			closeButton = new Button({
				text : sap.ui.getCore().getLibraryResourceBundle("sap.m").getText("MSGBOX_CANCEL"),
				press : function() {
					dialog._oCloseTrigger = true;
					dialog.close();
				}
			});

			dialog = new (sap.ui.require('sap/m/Dialog'))({
				stretch: true,
				customHeader: customHeader,
				content: getList(),
				beginButton : closeButton,
				beforeOpen: function() {
					originalValue = oInput.getValue();
					dialogSearchField.setValue(originalValue);
				},
				beforeClose: function(oEvent) {
					if (oEvent.getParameter("origin")) {
						// Cancel button: set original value
						oInput.setValue(originalValue);
					} else { // set current value
						oInput.setValue(dialogSearchField.getValue());
					}
				},
				afterClose: function(oEvent) {
					if (!oEvent.getParameter("origin")) { // fire the search event if not cancelled
						oInput.fireSearch({
							query: oInput.getValue(),
							refreshButtonPressed: false,
							clearButtonPressed: false
						});
					}
				}
			});
			dialog.addEventDelegate({
				ontap: ontap
			}, oInput);
			return dialog;
		}
function createDialog() {
			var dialog,
				originalValue,
				dialogSearchField,
				customHeader,
				closeButton;

			// use sap.ui.require to avoid circular dependency between the SearchField and Suggest
			dialogSearchField = new (sap.ui.require('sap/m/SearchField'))({
				liveChange : function (oEvent) {
					var value = oEvent.getParameter("newValue");
					oInput.setValue(value);
					oInput.fireLiveChange({newValue: value});
					oInput.fireSuggest({suggestValue: value});
					self.update();
				},
				search : function (oEvent) {
					if (!oEvent.getParameter("clearButtonPressed")) {
						dialog.close();
					}
				}
			});

			customHeader = new Bar({
				contentLeft: dialogSearchField
			});

			closeButton = new Button({
				text : sap.ui.getCore().getLibraryResourceBundle("sap.m").getText("MSGBOX_CANCEL"),
				press : function() {
					dialog._oCloseTrigger = true;
					dialog.close();
				}
			});

			dialog = new (sap.ui.require('sap/m/Dialog'))({
				stretch: true,
				customHeader: customHeader,
				content: getList(),
				beginButton : closeButton,
				beforeOpen: function() {
					originalValue = oInput.getValue();
					dialogSearchField.setValue(originalValue);
				},
				beforeClose: function(oEvent) {
					if (oEvent.getParameter("origin")) {
						// Cancel button: set original value
						oInput.setValue(originalValue);
					} else { // set current value
						oInput.setValue(dialogSearchField.getValue());
					}
				},
				afterClose: function(oEvent) {
					if (!oEvent.getParameter("origin")) { // fire the search event if not cancelled
						oInput.fireSearch({
							query: oInput.getValue(),
							refreshButtonPressed: false,
							clearButtonPressed: false
						});
					}
				}
			});
			dialog.addEventDelegate({
				ontap: ontap
			}, oInput);
			return dialog;
		}
function createDialog ( ) { var dialog , originalValue , dialogSearchField , customHeader , closeButton ; // use sap.ui.require to avoid circular dependency between the SearchField and Suggest dialogSearchField = new ( sap . ui . require ( 'sap/m/SearchField' ) ) ( { liveChange : function ( oEvent ) { var value = oEvent . getParameter ( "newValue" ) ; oInput . setValue ( value ) ; oInput . fireLiveChange ( { newValue : value } ) ; oInput . fireSuggest ( { suggestValue : value } ) ; self . update ( ) ; } , search : function ( oEvent ) { if ( ! oEvent . getParameter ( "clearButtonPressed" ) ) { dialog . close ( ) ; } } } ) ; customHeader = new Bar ( { contentLeft : dialogSearchField } ) ; closeButton = new Button ( { text : sap . ui . getCore ( ) . getLibraryResourceBundle ( "sap.m" ) . getText ( "MSGBOX_CANCEL" ) , press : function ( ) { dialog . _oCloseTrigger = true ; dialog . close ( ) ; } } ) ; dialog = new ( sap . ui . require ( 'sap/m/Dialog' ) ) ( { stretch : true , customHeader : customHeader , content : getList ( ) , beginButton : closeButton , beforeOpen : function ( ) { originalValue = oInput . getValue ( ) ; dialogSearchField . setValue ( originalValue ) ; } , beforeClose : function ( oEvent ) { if ( oEvent . getParameter ( "origin" ) ) { // Cancel button: set original value oInput . setValue ( originalValue ) ; } else { // set current value oInput . setValue ( dialogSearchField . getValue ( ) ) ; } } , afterClose : function ( oEvent ) { if ( ! oEvent . getParameter ( "origin" ) ) { // fire the search event if not cancelled oInput . fireSearch ( { query : oInput . getValue ( ) , refreshButtonPressed : false , clearButtonPressed : false } ) ; } } } ) ; dialog . addEventDelegate ( { ontap : ontap } , oInput ) ; return dialog ; }
/* =========================================================== /* internal helper functions /* ===========================================================
/ * =========================================================== / * internal helper functions / * ===========================================================
Creates a dialog