add

adds a data item to the dataview

void add(object obj, [number index] );

Parameters

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

Example

// initializing a dataview
var myDataView = new dhtmlXDataView({
    container:"data_container",
    type:{
        template:"Package"
    }
});
 
// adding a new data item to the dataview
myDataView.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