Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3132

Bind JSON after init function call

$
0
0

Hi,

 

I have JSON that is filled out during init function.

 

Example, I have JSON

 

onInit: function() {

         var list = {

  ablist: [

     {

       name: "Test",

       age: "TestAge"

     }]

     };

     var oModel = new JSONModel(list);

     this.getView().setModel(oModel);

     this.fillJSON();

  },

 

fillJSON: function(){

   //function that pushes more data to JSON

}

 

My view is:

 

    <t:Table id="table"

  selectionMode="MultiToggle"

  visibleRowCount="7"

  enableSelectAll="false"

  rows="{

  path: '/ablist'

  }"

  threshold="15"

  enableBusyIndicator="true">

  <t:noData>

  <BusyIndicator class="sapUiMediumMargin"/>

  </t:noData>

        <t:columns>

            <t:Column width="{ui>/widths/name}">

                <Label text="Student Name"/>

                <t:template> <Text text="{name}"/></t:template>

            </t:Column>

        </t:columns>

    </t:Table>

 

But when page loads, it only shows one row with "Test". I checked the JSON if it has values with

 

MessageToast.show(oModel.getProperty('/list/2/name')); and the JSON is populated.

 

How can I load table AFTER I add data through init function?


Viewing all articles
Browse latest Browse all 3132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>