javascript - How do i write Infinite Row-repeater in an Xml View in SAPUI5 -


i trying display complex json data in sapui5.

here complex data:

results:{          "name" : "sample",          "child" : [                     "name" : "sample",                     "child" : [                         "name" : "sample",                         "child" : [                                     "name" : "sample",                                     "child" : [                                       ]                                   ]                      ]                  ]         } 

here inner child infinite. these depending on data.

so here question how display type of data in xml view.

previously displayed type of data using row repeater. there data has 3 levels. has infinite. how can use row repeater displaying type of data.

here 3-level row repeater.

<c:rowrepeater rows="{path: bindingpath}" id="rowrepeater" >       <c:rowrepeater rows="{path: bindingpath/somepath}" >             <c:rowrepeater rows="{path: bindingpath/somepath/anotherpath}">              </c:rowrepeater>       </c:rowrepeater> </c:rowrepeater> 

that's intriguing question don't think rowrepeater that.

if want bind row attribute of rowrepeater control, should pass array each position in array row in output.

in results object, have 1 "root node". rowrepeater render output if have 2 or more nodes. moreover, binding path can hold 1 value if think changing dynamically won't work levels of data in model.

see example below:

<!doctype html>  <html>  <head>      <script src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js" id="sap-ui-bootstrap" data-sap-ui-theme="sap_bluecrystal" data-sap-ui-libs="sap.ui.commons"></script>        <meta charset="utf-8">    <title>js bin</title>            <script>       // create row repeater control  		var orowrepeater = new sap.ui.commons.rowrepeater("rr1");  		orowrepeater.setnodata(new sap.ui.commons.textview({text: "sorry, no data available!"}));                     //var dataobject = {data: ["a","b"]};          var dataobject = { data: [            { name: "a",            children: [                       {name: "a1",                        children: [                            {name: "a1a"}                            ]                        },                       {name: "a2"}                       ]            },            {name: "b"} // try remove line... rowrepeater won't rendered there 1 position                      ]};              		// create json model  		var omodel = new sap.ui.model.json.jsonmodel(dataobject);  		sap.ui.getcore().setmodel(omodel);      		//create title  		var otitle = new sap.ui.core.title({text:"letters"});            orowrepeater.settitle(otitle);    		//configure rowrepeater  		orowrepeater.setdesign("standard");  //		orowrepeater.setnumberofrows(5);  //		orowrepeater.setcurrentpage(1);  		orowrepeater.settitle(otitle);              var orowtemplate = new sap.ui.commons.textview({            text: "{name}",          });            		orowrepeater.bindrows("/data", orowtemplate);    		orowrepeater.placeat("content");    </script>  </head>          <body class="sapuibody" role="application">    <div id="content"></div>  </body>    </html>

what need more related element binding aggregation binding.

so, if have many levels on model recommend using controls tree or treetable.


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -