<?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: JSON Table with editable field using suggestions... in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/json-table-with-editable-field-using-suggestions/qaa-p/11863998#M4452548</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for that Jose, I'd seen those "&amp;gt;" before, but never used them / understood how they worked.&lt;/P&gt;&lt;P&gt;That's really useful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 Aug 2016 15:12:39 GMT</pubDate>
    <dc:creator>PatrickDean</dc:creator>
    <dc:date>2016-08-24T15:12:39Z</dc:date>
    <item>
      <title>JSON Table with editable field using suggestions...</title>
      <link>https://community.sap.com/t5/technology-q-a/json-table-with-editable-field-using-suggestions/qaq-p/11863996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt; Here's a pic of my app : &lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/jiveimages/1022289" height="173" width="771" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the "Type" Column, I want to be able to give suggestions, based on the user entry... e.g. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/jiveimages/1022290" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, I understand that in order to store my Services Table on the Frontend, I need it to have a JSON Model behind it... To add a new line, I do this:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;var oEntry = {};&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;oEntry.Type = "";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;oEntry.Description = "";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;oEntry.Qty = "";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;var moSTModel = new sap.ui.model.json.JSONModel();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;moSTModel = this.getView().byId("idServiceTable").getModel();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;//Get Data from the Model, add the entry we've just created to the Data, pass the Data back to the Model... &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;lmData = moSTModel.getData();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;lmData.rows.push(oEntry);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;moSTModel.setData(lmData);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;this.getView().byId("idServiceTable").setModel(moSTModel);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But for the auto-complete, I need oData; [Using XML view]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;Input value="{Type}" showSuggestion="true" suggestionItems="{/ServiceTypesSet}" &amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;lt;core:ListItem text="{Description}" additionalText="{Key}" /&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/suggestionItems&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just can't figure out how to combine the two? I guess I need to put the ServiceTypes into a new JSON too, and then refer to this in XML view somehow?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or do I need to add the list of ServiceTypes into each JSON table row, so that it's available to each line?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Currently:&lt;/P&gt;&lt;P&gt;Using JSON, I can satisfy the "Want to add lines to the model until such a time as the user hits save, then send them to the backend".&lt;/P&gt;&lt;P&gt;Using oData, I can satisfy the "Want to have a list of suggestion items that get auto-completed".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just don't know how to do the both at the same time!? &lt;SPAN style="font-size: 10pt;"&gt;Any help gratefully appreciated! Thanks guys!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This app was built using the sap.m library, with xml views, some JS occurring in the controllers...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Aug 2016 14:42:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/json-table-with-editable-field-using-suggestions/qaq-p/11863996</guid>
      <dc:creator>PatrickDean</dc:creator>
      <dc:date>2016-08-24T14:42:32Z</dc:date>
    </item>
    <item>
      <title>Re: JSON Table with editable field using suggestions...</title>
      <link>https://community.sap.com/t5/technology-q-a/json-table-with-editable-field-using-suggestions/qaa-p/11863997#M4452547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Patrick,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can try setting a name for one of the models. For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;&amp;lt;Table items="{/Data}"&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;columns&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;Column&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;header&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;Text text="First column"/&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;/header&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;/Column&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;Column&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;header&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;Text text="Seconf column"/&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;/header&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;items&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;ColumnListItem&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;cells&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;Input value="{type}" showSuggestion="true"&lt;/P&gt;
&lt;P&gt;&amp;nbsp; suggestionItems="{SuggestionModel&amp;gt;/ServicesTypesSet}"&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;suggestionItems&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;core:ListItem text="{SuggestionModel&amp;gt;description}"/&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;/suggestionItems&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;/Input&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;Text text="{info}"/&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;/cells&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;/ColumnListItem&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;/items&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;/Table&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And in the controller....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;this.getView().setModel(new sap.ui.model.json.JSONModel({&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Data: [{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; type: "1",&lt;/P&gt;
&lt;P&gt;&amp;nbsp; info: "One"&lt;/P&gt;
&lt;P&gt;&amp;nbsp; }]&lt;/P&gt;
&lt;P&gt;&amp;nbsp; }));&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; this.getView().setModel(new sap.ui.model.json.JSONModel({&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ServicesTypesSet: [{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; description: "first description"&lt;/P&gt;
&lt;P&gt;&amp;nbsp; },{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; description: "second description"&lt;/P&gt;
&lt;P&gt;&amp;nbsp; },{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; description: "third description"&lt;/P&gt;
&lt;P&gt;&amp;nbsp; }]&lt;/P&gt;
&lt;P&gt;&amp;nbsp; }), "SuggestionModel");&lt;/P&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;In this example i'm using two JSONModels, but it should work if you use one JSON and one OData.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Aug 2016 15:06:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/json-table-with-editable-field-using-suggestions/qaa-p/11863997#M4452547</guid>
      <dc:creator>JMMartinez</dc:creator>
      <dc:date>2016-08-24T15:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: JSON Table with editable field using suggestions...</title>
      <link>https://community.sap.com/t5/technology-q-a/json-table-with-editable-field-using-suggestions/qaa-p/11863998#M4452548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for that Jose, I'd seen those "&amp;gt;" before, but never used them / understood how they worked.&lt;/P&gt;&lt;P&gt;That's really useful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Aug 2016 15:12:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/json-table-with-editable-field-using-suggestions/qaa-p/11863998#M4452548</guid>
      <dc:creator>PatrickDean</dc:creator>
      <dc:date>2016-08-24T15:12:39Z</dc:date>
    </item>
  </channel>
</rss>

