cancel
Showing results for 
Search instead for 
Did you mean: 

how to get the input value in dialog which create by xmlfragment in fiori

former_member189009
Active Participant
0 Kudos

Dear friends,

     I used this code in my controller to create a dialog though xmlfragment, now I want to get the input value in the dialog how do I make it ? I try to use the same way to get the value just like this in my controller,but it didn't work.

var iordering = this.getView().byId("ApprovalInput");

SearchHelp: function() {

  if (!this._oViewsearchDialog) {

  this._oViewsearchDialog = sap.ui.xmlfragment("Demo.view.SearchHelpDialog", this);

  this.getView().addDependent(this._oViewsearchDialog);

  this._oViewsearchDialog.addStyleClass(this.getOwnerComponent().getContentDensityClass());

  }

  this._oViewsearchDialog.open();

  },

some of my xmlfragment code:

<Label design="Bold" id="VSDThemeLabel" text="Approval Status"/>

  <Input id="ApprovalInput" placeholder="Enter Product ..." showSuggestion="true" suggestionItems="{/PurchaseOrderCollection}" type="Text">

  <suggestionItems>

  <core:Item text="{ApprovalStatus}"/>

  </suggestionItems>

  </Input>

Thanks for your sincerely answer!

Zhang

Accepted Solutions (1)

Accepted Solutions (1)

pfefferf
Active Contributor
0 Kudos

Hello,

check Retrieving Control Instances by their ID. The help describes how you can retrieve a control placed on a fragement for the different constellations.

Regards,

Florian

former_member189009
Active Participant
0 Kudos

Hi Florian,

    Thanks for the help, but I try, it didn't work. I use xmlfragment:

this._oViewsearchDialog = sap.ui.xmlfragment("Demo.view.SearchHelpDialog", this);

this.getView().addDependent(this._oViewsearchDialog);

<Input id="ApprovalInput" placeholder="Enter Product ..." showSuggestion="true" suggestionItems="{/PurchaseOrderCollection}" type="Text">

  </Input>

      And I use this to get the control after check the Retrieving Control Instances by their ID.  but it still not work.

var iapprolval = this.byId(sap.ui.core.Fragment.createId(this._oViewsearchDialog, "ApprovalInput"));

var iordering = this.byId("OrderingInput");

pfefferf
Active Contributor
0 Kudos

Hi,

because your xml fragment is not embedded into your xml view but is a dialog and you are also not setting the fragment ID of your fragment your coding will not work.

So either you use sap.ui.getCore().byId("ApprovalInput"); to get your control, or you set an ID for your fragment (this._oViewSearchDialog = sap.ui.xmlfragment("frgSearchHelpDialog", "Demo.view.SearchHelpDialog",this);) and determine the control via sap.ui.core.Fragment.byId("frgSearchHelpDialog", "ApprovalInput");

Regards,

Florian

Answers (1)

Answers (1)

former_member225463
Participant
0 Kudos

Hello Zongjie,

Please us the code

sap.ui.getCore().byId("inputid").getValue();


Regards,

Vikash