Advertisement
yskang

adsk-forge-LevelSectionPanel-step3&4

Apr 29th, 2019
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. async createUI() {
  2.     this.uiCreated = true;
  3.     const table = document.createElement( 'table' );
  4.     table.className = 'adsk-lmv-tftable adn-lvl-section-panel-table';
  5.  
  6.     const tbody = document.createElement( 'tbody' );
  7.     table.appendChild( tbody );
  8.     this.scrollContainer.appendChild( table );
  9.  
  10.     const upperRow = tbody.insertRow( -1 );
  11.     const upperTextCell = upperRow.insertCell( 0 );
  12.     upperTextCell.innerText = 'Upper:';
  13.     const upperSelectCell = upperRow.insertCell( 1 );
  14.  
  15.     const lowerRow = tbody.insertRow( -1 );
  16.     const lowerTextCell = lowerRow.insertCell( 0 );
  17.     lowerTextCell.innerText = 'Lower:';
  18.     const lowerSelectCell = lowerRow.insertCell( 1 );
  19.  
  20.     // ...
  21.  
  22.     const upperLvlSelector = document.createElement( 'select' );
  23.     upperLvlSelector.id = 'adn-upper-lvl-selector';
  24.     upperLvlSelector.className ='adn-lvl-selector';
  25.     upperSelectCell.appendChild( upperLvlSelector );
  26.  
  27.     const lowerLvlSelector = document.createElement( 'select' );
  28.     lowerLvlSelector.id = 'adn-lower-lvl-selector';
  29.     lowerLvlSelector.className = 'adn-lvl-selector';
  30.     lowerSelectCell.appendChild( lowerLvlSelector );
  31.  
  32.     const data = await this.getRemoteLevels();
  33.     this.levels = data;
  34.  
  35.     this.createSelectOptions( data, upperLvlSelector );
  36.     this.createSelectOptions( data, lowerLvlSelector );
  37.  
  38.     // ...
  39.  
  40.     const buttonRow = tbody.insertRow( -1 );
  41.     const buttonCell = buttonRow.insertCell( 0 );
  42.     buttonCell.colSpan = 2;
  43.  
  44.     const sectionButton = document.createElement( 'button' );
  45.     sectionButton.type = 'button';
  46.     sectionButton.textContent = 'Apply';
  47.     buttonCell.appendChild( sectionButton );
  48.     sectionButton.addEventListener( 'click', this.onButtonClicked );
  49.  
  50.     this.resizeToContent();
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement