Advertisement
yskang

threejs-viewer-13

May 6th, 2020
1,028
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. constructor( parentContainer ) {
  2.     this.parentContainer = parentContainer; this.init();
  3. }
  4.  
  5. setProperties( props ) {
  6.     if( !props || props.length <= 0 ) return;
  7.  
  8.     // Clear table rows
  9.     const tbody = this.content.firstChild;
  10.      while( tbody.hasChildNodes() ) {
  11.          tbody.removeChild( tbody.firstChild );
  12.     }
  13.  
  14.     const rowInx = -1;
  15.     const propNames = Object.keys( props );
  16.  
  17.     for( let i = 0, len = propNames.length; i < len; i++) {
  18.         let colInx = 0;
  19.         const propName = propNames[i];
  20.         const propValue = props[ propName ];
  21.         if( !propValue ) continue;
  22.         const propRow = tbody.insertRow( rowInx );
  23.         const nameCell = propRow.insertCell( colInx++ );
  24.         nameCell.innerText = propName;
  25.         const valueCell = propRow.insertCell( colInx++ );
  26.         valueCell.innerText= propValue;
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement