ListColumnDisplay.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. define( function() {
  2. "use strict";
  3. function C_ListColumnDisplay()
  4. {
  5. };
  6. C_ListColumnDisplay.prototype.draw = function( oControlHost )
  7. {
  8. var o = oControlHost.configuration;
  9. this.m_oList = oControlHost.page.getControlByName( ( o ? o.name : "" ) || "List1" );
  10. var el = oControlHost.container;
  11. el.innerHTML =
  12. '<style>' +
  13. '.myTextBox { width:160px; text-align:right; color:#6793CB; font-size:24px; padding:6px 12px 6px 12px; background-color:white; border:1px solid #6793CB; }' +
  14. '.myButton { margin-left:8px; color:#6793CB; font-size:24px; padding:6px 12px 6px 12px; background-color:white; border:1px solid #6793CB; }' +
  15. '.myButton:hover { background-color:#6793CB; color:white; border:1px solid #6793CB; }' +
  16. '</style>' +
  17. '<input class="myTextBox txt" type="text" value=""/>' +
  18. '<button class="myButton btnShow" type="button">Show</button>' +
  19. '<button class="myButton btnHide" type="button">Hide</button>';
  20. this.m_txt = el.querySelector( "*[class*='txt']" );
  21. el.querySelector( "*[class*='btnShow']" ).onclick = this.setColumnDisplay.bind( this, true );
  22. el.querySelector( "*[class*='btnHide']" ).onclick = this.setColumnDisplay.bind( this, false );
  23. };
  24. C_ListColumnDisplay.prototype.setColumnDisplay = function( bDisplay )
  25. {
  26. var a = this.m_txt.value.split( "," );
  27. for ( var i = 0; i < a.length; i++ )
  28. {
  29. this.m_oList.setColumnDisplay( parseInt( a[i] ), bDisplay );
  30. }
  31. };
  32. return C_ListColumnDisplay;
  33. });