rlsaj
rlsaj

Reputation: 735

Dijit widget to add another input field?

I am after recommendations of what dijit widget I can use for the screenshot below. Our users will need to add another row.

Add another row

Upvotes: 0

Views: 401

Answers (1)

mschr
mschr

Reputation: 8641

Can use

function createRow(ParentNode) {
    require(["dojo/_base/parser", "dojo/dom-construct"], function(parser, domConstruct){
      var div = dojo.create("div", { 'data-dojo-type' : 'dijit.form.TextBox' }, ParentNode);
      parser.parse(div);
    };
}

Or

function createRow(ParentNode) {
     var row = new dijit.form.TextBox( { /* params */ } );
     row.placeAt(ParentNode);
     row.startup();
}

With

<div id="parent">
  <div data-dojo-type="dijit.form.TextBox"></div>
</div>
<div 
  data-dojo-type="dijit.form.Button"
  data-dojo-props="onClick: function() { createRow('parent'); }"
></div>

Upvotes: 1

Related Questions