expand - How to make SAPUI5 TreeTable expanded by default? -


i use following code (in controller):

onafterrendering: function () {     var t, i;     if (!this.initexpand) {         try {             t = this.getview().getcontent()[1];             (i=0; i<t.getrows().length; i++) {                 t.expand(i);             }             this.initexpand = true;         } catch (e) {             console.log("expand failed: "+e.message);         }     } }, 

for initial (after loading , rendering) expanding nodes of following sap.ui.table.treetable (in view):

<mvc:view     displayblock="true"      xmlns:l="sap.ui.layout"     xmlns:table="sap.ui.table"     xmlns:mvc="sap.ui.core.mvc"     controllername="sap.app.controller.scr1" >     <l:horizontallayout>         <searchfield livechange="onsearch"/>     </l:horizontallayout>     <table:treetable rows="{/root}"         selectionmode="none"         visiblerowcount="11"         showcolumnvisibilitymenu="true"         enablecellfilter="true"         enablecolumnreordering="false"         class="sapuisizecompact"         expandfirstlevel="true"     >         <table:columns>         ...         </table:columns>     </table:treetable> </mvc:view> 

but nodes still not expanded (remains collapsed).

is there other (more stable) way initial expanding nodes of sap.ui.table.treetable?

the below code works:

onafterrendering: function(){     var otreetable = this.getview().byid("mytreetableid");    otreetable.expandtolevel(3); //number of levels of tree table.  } 

where '3' number of levels tree table and,

mytreetableid: id of control @ xml view:

<table:treetable id="mytreetableid" ... 

Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -