DHTMLX Docs & Samples Explorer

addItem(pId, itemData, pos, insertAfter)

Adds a new item.

Required file: ext/dhtmlxform_dyn.js

Parameters:

  • pId - the parent item id, i.e. the id of the existing item you want to nest the new item into (the item's parameter 'name).
  • itemData - the object of the new item.
  • pos - the position that the new item will be added to.
  • insertAfter - (true/false, default false) if any “newcolumn” used - item will inserted into colunm where item[pos] positioned, before it; insertAfter specifies that new item will inserted after item[pos], to add possibility to make new item last in column; this param is ignored when inserting newcolumn.
//to add as an individual item
myForm.addItem(null, itemData, pos);
 
//to nest into some existing item
myForm.addItem(pId, itemData, pos);

Details:

  • If you don't want to specify the parent item, set the pId parameter to null.
  • For radio buttons you must specify the pId parameter as an array with 2 elements:
    • rId - the radio button's id (the radio's parameter 'name').
    • rValue - the radio button's value (the radio's parameter 'value').