generatortable

by Wolfgang Fahl

HTML

<table id='generatortable'>
    <thead id='tablehead'><tr id='headerrecord'><th><button onclick='return rungenerator();'><img src='https://cdn0.iconfinder.com/data/icons/ie_Glossy_button/48/button_16.png'/></button></th></tr></thead>
    <tbody id='tablebody'></tbody>
</table>
<div id='result'>
</div>

JavaScript

function rungenerator() { 
  var list="";
  var delim="";
    $(".checkBoxClass:checked").each(
    function( index, value ) {
      id=this.id;
      var generator=generators[id];
      console.log(generator);
      list=list+delim+id;
      delim=", ";
  });
  console.log(list);
  $("#result").html(list);
  return false;
}
// add a TextElement with the given tag and message to the given parent
function newTextElement(tag, msg) {
    var newElement = document.createElement(tag);
    var content = document.createTextNode(msg);
    newElement.appendChild(content);
    return newElement;
}
// add an image to the given parent
function addImage(pParent, pSrc, pAlt, pTitle) {
    var lbreak = document.createElement('br');
    pParent.appendChild(lbreak);
    var newImage = document.createElement('img');
    newImage.src = pSrc;
    newImage.alt = pAlt;
    newImage.title = pTitle;
    pParent.appendChild(newImage);
    return newImage;
}

// create a new generator with the given id, y-technical and topic
function Generator(id, yt, topic) {
    this.id = id;
    this.yt = yt;
    this.topic = topic;
    return( this );
}

// jquery startup
$(document).ready(function () {
    
    
    var jsontext='{"key":"MetaModel","topics":[{"context":"MetaModel","defaultstoremode":"property","documentation":"a Property is a Feature/Attribute","icon":"File:Element_into_input.png","key":"Concept:Property","name":"Property","pluralName":"Properties","wikiDocumentation":"see\n    https://semantic-mediawiki.org/wiki/Help:Properties_and_types\n    https://semantic-mediawiki.org/wiki/Help:Special_properties"},{"context":"MetaModel","defaultstoremode":"subobject","documentation":"an SMW_Type is a data type which determines the possible values for that type e.g. a Boolean can hold true/fals values while a Number can hold 3.1459 or 20. A Page can hold the name of a Wiki page see...