You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<divlayout="row"><divflex>column1</div><divflex>column2</div></div><!-- or if you have an array arrColumns that defines columns --><divlayout="row"><divng-repeat="objCol in arrColumns" flex> {{objCol}} </div></div>
Rows Example in Angular
<divlayout="column"><divflex>row1</div><divflex>row2</div></div><!-- or if you have an array arrRows that defines columns --><divlayout="column"><divng-repeat="objRow in arrRows" flex> {{objRow}} </div></div>
Recursive function to create hierarchical containers in javascript
/*Example data structure, with infinite depth{ id:'parent id',kids:[ {id:'kid1'} ,{id:'kid2',kids:[ {id:'grandkid'} ]}]}*/varfnCreateLayout=function(objConfig){//recursive function, calls itself for each child and so do theyself.last_updated=Date.now();//find the current itemvarobjElement=document.getElementById(objConfig.id);//determine layout direction, alternating rows and columnsif(typeofobjConfig.layout==='undefined'){if(objElement.clientWidth>objElement.clientHeight){objConfig.layout='dashboard-columns';}if(objElement.clientWidth<objElement.clientHeight){objConfig.layout='dashboard-rows';}}//add a subcontainer for kidsvarobjKids=document.createElement('div');objKids.setAttribute('class','dashboard-kids '+objConfig.layout);objElement.appendChild(objKids);//add the kidsfor(vari=0;i<objConfig.kids.length;i++){// add ancestry//add elementvarobjKid=document.createElement('div');objKid.setAttribute('id',objConfig.kids[i].id);objKids.appendChild(objKid);//if child is missing states, copy them.if(typeofobjConfig.kids[i].states==='undefined'||objConfig.kids[i].states.length===0){objConfig.kids[i].states=objConfig.states;}//call self for the created kid nodefnCreateLayout(objConfig.kids[i]);}returnobjElement;
move columns by manipulating the array they are build from
vararrColumns=[{id:1},{id:2},{id:3}];//add a new column to the endarrColumns.push({id:4});//remove a column from the beginningarrColumns.shift();
move columns by manipulating the array they are build from
<divlayout="row"><divng-repeat="objCol in arrColumns">
column {{objCol.id}}
</div></div>