Items operations: adding, editing and deleting

Adding

view.add({
         id:"some id",
         property:"some value"
})

If “id” is not defined - it will be auto-generated.

Deleting

view.remove("some id");
//or
view.remove(["idA","idB","idC","idD"]);

Editing

To enable item editing ability you must perform 2 steps:

  1. Enable edit mode
  2. Define edit template
view = new dhx.ui({
        view:"dataview",
	container:"data_container",
	edit:true,
	type:{
            template:"#Package# : #Version#<br/>#Maintainer#",
            templateEdit:"<input class='dhx_item_editor' bind='obj.Package'>"
        }
});

Edit template works at the same way as normal one plus, tags inside it can have bind attribute. That means than during switching to the edit state, component will put related properties into inputs, and on edit-end command, properties will be filled from the inputs respectfully.

By default, edit process is triggered by double click.

You can switch cell to edit manually, by using

view.edit(id);
//
view.stopEdit();