DisplayAllPromptValues.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. define(function () {
  2. "use strict";
  3. function DisplayAllValues() {
  4. };
  5. DisplayAllValues.prototype.draw = function (oControlHost) {
  6. var elPVInfo = oControlHost.container;
  7. elPVInfo.innerHTML =
  8. '<style>' +
  9. '.myButtonPromptValueInfo { height:32px; width:180px; cursor:pointer; margin-left:5px; color:#4178BE; font-size:14px; padding:6px 12px 6px 12px; background-color:white; border:1px solid #4178BE; }' +
  10. '.myButtonPromptValueInfo:hover { background-color:#4178BE; color:white; border:1px solid #4178BE; }' +
  11. '</style>' +
  12. '<button class="myButtonPromptValueInfo btnPV" type="button">Get All Prompt Values</button><div></div>';
  13. elPVInfo.querySelector(".btnPV").onclick = getAllPromptValues.bind(this, oControlHost);
  14. }
  15. function getAllPromptValues(oControlHost) {
  16. var oControl = oControlHost.page.getControlByName("promptProdLine");
  17. var aValues = oControl.getValues(true);
  18. //var elValues = oControlHost.container.lastChild;
  19. var elValues = oControlHost.container.querySelector("div");
  20. var sTable = '<br/><table><tr><th align="left">Use</th><th align="left">Display</th></tr>';
  21. for (var j = 0; j < aValues.length; j++) {
  22. var oValue = aValues[j];
  23. sTable += '<tr>';
  24. sTable += '<td width="200px">' + oValue.use + '</td>';
  25. sTable += '<td width="200px">' + oValue.display +'</td>';
  26. sTable += '</tr>';
  27. }
  28. elValues.innerHTML = sTable;
  29. };
  30. return DisplayAllValues;
  31. }
  32. );