I’m making a live editor that would allow me to edit and add objects to a document, and then use the list in other documents. I would like to make these documents more like database tables with rows in them that will be XObjects attached to the document.
So far I got this:
For editing of properties, I looked at the editableProperty.js code and managed to edit the properties of existing objects successfully.
After I input text in the input fields and press on the Add new Person button, I’d like it to add the object of the Person class with the specified fields But I can’t find it anywhere how to add objects to the document. I went through these guides: Scripting API Guide, XWiki JavaScript API, FAQ Tutorial(Manual), Structured data access API (EXPERIMENTAL), Structured data access JS API (EXPERIMENTAL) and other guides, but I can’t find information on how to add and delete objects.
In Velocity I can do:
## Create an object
#set($obj = $doc.newObject("XWiki.SomeClass"))
$obj.set("field1",$value1)
$obj.set("field2",$value2)
## Save the object in the page
$doc.save()
As shown in the Scripting API Guide, but I don’t understand how to do this when the button is pressed.