<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: UI5 - Enable Button on XML View in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/ui5-enable-button-on-xml-view/qaa-p/10578730#M3848482</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Quick update.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I "inspected" the element in Chrome and it had the ID "idViewRoot--idViewDetail--rejectButton". &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 30 Sep 2014 15:57:10 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2014-09-30T15:57:10Z</dc:date>
    <item>
      <title>UI5 - Enable Button on XML View</title>
      <link>https://community.sap.com/t5/technology-q-a/ui5-enable-button-on-xml-view/qaq-p/10578729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an XMLview in which I have a button on it, which is disabled. Defined using the following code: -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;Button id="rejectButton" enabled="false" text="Delete" type="Reject"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; icon="sap-icon://delete" press="onDelete" /&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The app is a split view. This button appears on the detail view. Now, I want to be able to click an entry in the master view and in turn enable this button.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am failing miserably. I presume I may need to get hold of the button ID and somehow set the enabled to true. I am thinking I need to be using the sap.ui.getCore() thingy, but do not know how to specify an ID. &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Could someone point me in the right direction of how to get the button element, so that I can enable it. Or if this is the wrong solution, tell me how I should be enabling it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Martin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Sep 2014 15:49:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/ui5-enable-button-on-xml-view/qaq-p/10578729</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-09-30T15:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: UI5 - Enable Button on XML View</title>
      <link>https://community.sap.com/t5/technology-q-a/ui5-enable-button-on-xml-view/qaa-p/10578730#M3848482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Quick update.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I "inspected" the element in Chrome and it had the ID "idViewRoot--idViewDetail--rejectButton". &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Sep 2014 15:57:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/ui5-enable-button-on-xml-view/qaa-p/10578730#M3848482</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-09-30T15:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: UI5 - Enable Button on XML View</title>
      <link>https://community.sap.com/t5/technology-q-a/ui5-enable-button-on-xml-view/qaa-p/10578731#M3848483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I normally just bind the enabled property to a model, and then update the model.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's a simple example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://jsbin.com/soqiluxedalo/1/edit"&gt;http://jsbin.com/soqiluxedalo/1/edit&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jason&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Sep 2014 16:21:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/ui5-enable-button-on-xml-view/qaa-p/10578731#M3848483</guid>
      <dc:creator>jmoors</dc:creator>
      <dc:date>2014-09-30T16:21:28Z</dc:date>
    </item>
    <item>
      <title>Re: UI5 - Enable Button on XML View</title>
      <link>https://community.sap.com/t5/technology-q-a/ui5-enable-button-on-xml-view/qaa-p/10578732#M3848484</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So this is possible programatically (but not recommended) by using&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;sap.ui.getCore().byId("&lt;SPAN style="color: #333333; font-size: 12px;"&gt;idViewRoot--idViewDetail--rejectButton")&lt;/SPAN&gt;&lt;/P&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This should get you the button object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that you have to specify the id of not only the button but also the view hierarchy it is placed withing (idRootView =&amp;gt; idViewDetail) so if you move the button or change any higher up ids, then you have to change the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using a local state JSON model, as suggested, is preferable and you can bind other things to the semantic action of enabling the button if needed with no more code. You also have the freedom to change the UI from the button logic and it makes use of the framework to do all the heavy lifting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Oli&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Sep 2014 23:28:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/ui5-enable-button-on-xml-view/qaa-p/10578732#M3848484</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-09-30T23:28:27Z</dc:date>
    </item>
    <item>
      <title>Re: UI5 - Enable Button on XML View</title>
      <link>https://community.sap.com/t5/technology-q-a/ui5-enable-button-on-xml-view/qaa-p/10578733#M3848485</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A bit off-topic, but as a reminder when using XML views you should use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;this.getView().byId("rejectButton");&lt;/P&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;instead of&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;sap.ui.getCore().byId("the--whole--dreadful--view--layout--id--to--your--rejectButton");&lt;/P&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, of course the recommended approach is not to get a reference to the control and use the setEnabled() method, but to use a local JSON model to bind these UI properties as you and &lt;A _jive_internal="true" href="https://answers.sap.com/people/jason.moors3"&gt;Jason Moors&lt;/A&gt; correctly stated&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Oct 2014 09:02:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/ui5-enable-button-on-xml-view/qaa-p/10578733#M3848485</guid>
      <dc:creator>Qualiture</dc:creator>
      <dc:date>2014-10-01T09:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: UI5 - Enable Button on XML View</title>
      <link>https://community.sap.com/t5/technology-q-a/ui5-enable-button-on-xml-view/qaa-p/10578734#M3848486</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Robin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes this is true but only if the required control is within the current view. The view.byId function searches only within itself. It actually prepends the current views' id to the id passed to that function and uses the sap.ui.core.byId function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The OP wanted to change a control in a different view hierarchy and so the only way to do it by id is to specify the entire thing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The best way is to use a little local JSON state model though as it puts all the hard work on the framework.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Oli&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Oct 2014 12:17:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/ui5-enable-button-on-xml-view/qaa-p/10578734#M3848486</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-10-03T12:17:43Z</dc:date>
    </item>
  </channel>
</rss>

