add

adds a data item to the list

void add(object obj,number index);

Parameters

objobjectthe item object
indexnumberoptional, the item's position (zero-based numbering)

Example

var myList = new dhtmlXList({
    container:"data_container",
    type:{
        template:"Package"
    }
});
myList.add({
    id:15,
    Package:"test one",
    Version:"0.1",
    Maintainer:"dhtmlx" 
}, 0)

Details

Note:

  • if the index parameter isn't specified in the method, the item will be added to the bottom of the list
  • if the id property isn't specified for the item, it will be auto generated
See also
Back to top