title: Using BasicPrimitives: How to add child to a famdiagram?
body: <p>I've been trying to use <a href="http://www.basicprimitives.com/" rel="nofollow">BasicPrimitives</a> to make a family tree application, but I can't seem to refresh the diagram with fresh data after adding a new child :) </p>
  
  <pre><code>items.push(newItem);
  </code></pre>
  
  <p>works, but I have to click on one item so that the whole diagram would refresh and show the newly added item</p>
  
  <p>when I try to use the update tree function I get no results:</p>
  
  <pre><code> jQuery("#basicdiagram").famDiagram("update", primitives.famdiagram.UpdateMode.Refresh);
  </code></pre>
  
  <p>also this didn't get me anywhere as well:</p>
  
  <pre><code>jQuery("#basicdiagram2").orgDiagram({
         items: items,
         cursorItem: newItem.id
  });
  </code></pre>
  
  <p>Any help would be great :)</p>
  
  <p>EDIT: this is the code:</p>
  
  <pre><code>  &lt;!DOCTYPE html&gt; 
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta http-equiv="content-type" content="text/html; charset=UTF-8"&gt;
      &lt;title&gt;Adding new items at run time&lt;/title&gt;
  
      &lt;link rel="stylesheet" href="demo/js/jquery/ui-lightness/jquery-ui-1.10.2.custom.css" /&gt;
      &lt;script type="text/javascript" src="demo/js/jquery/jquery-1.9.1.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="demo/js/jquery/jquery-ui-1.10.2.custom.min.js"&gt;&lt;/script&gt;
     &lt;script type="text/javascript" src="demo/js/primitives.min.js"&gt;&lt;/script&gt;
      &lt;link href="demo/css/primitives.latest.css" media="screen" rel="stylesheet" type="text/css" /&gt;
  
      &lt;script type='text/javascript'&gt;//&lt;![CDATA[ 
  
          $(window).load(function () {
              var options = new primitives.famdiagram.Config();
              var maximumId = 5;
  
              var items = [
                   new primitives.famdiagram.ItemConfig({ id: 1,parents: null, title: "Thomas Williams", label: "Thomas Williams", description: "4, VP, Server &amp; Tools Marketing and Solutions", phone: "904-547-5342", email: "thomwill@name.com", image: "demo/images/photos/r.png", itemTitleColor: "#4b0082" }),
  
                new primitives.famdiagram.ItemConfig( { id: 2, parents: null, title: "Sara Kemp", label: "Sara Kemp", description: "15, VP, Software &amp; Enterprise Management Division", phone: "918-257-4218", email: "sarakemp@name.com", image: "demo/images/photos/g.png", itemTitleColor: "#4b0082" })
  
              ];
  
  
  
              var buttons = [];
              buttons.push(new primitives.famdiagram.ButtonConfig("delete", "ui-icon-close", "Delete"));
              buttons.push(new primitives.famdiagram.ButtonConfig("properties", "ui-icon-gear", "Info"));
              buttons.push(new primitives.famdiagram.ButtonConfig("add", "ui-icon-person", "Add"));
              options.items = items;
              var panel = jQuery("#panel");
              var orgchartform = panel.find("[name=orgchartform]")
  
              options.cursorItem = 0;
              options.linesWidth = 1;
              options.linesColor = "black";
              options.hasSelectorCheckbox = primitives.common.Enabled.True;
              options.lineItemsInterval = 5;
              options.buttons = buttons;
              options.hasButtons = primitives.common.Enabled.True;
              options.hasSelectorCheckbox = primitives.common.Enabled.False;
  
  
              options.onButtonClick = function (e, data) {
  
                  if(data.name == 'add')
                  {
  
                                  var items = jQuery("#basicdiagram2").famDiagram("option", "items");
  
  
                                  var newItem = new primitives.famdiagram.ItemConfig(
                                    {
                                        id: 3,
                                        parents: [1, 2],
                                        title: "title",
                                        label: "Name",
                                        description: "15, VP, Management Division",
                                        phone: "918-257-4218",        
                                        itemTitleColor: "#4b0082" 
  
                                    });  
  
                                  items.push(newItem);
  
                    }
  
              };
  
              jQuery("#basicdiagram2").famDiagram(options);
  
          });//]]&gt;  
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  
    &lt;div id="basicdiagram2" style="width: 640px; height: 480px; border-style: dotted; border-width: 1px;" /&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>