Search code examples
2sxc

2sxc - create new data object with javascript


Is the only posible way to add new data object with javascript to use WebApi, or is posible to add object without showing 2sxc edit form just with javascript.

I know how to create new object with prefilled values with default or custom toolbar and even by only links. But that way the default 2sxc edit form is shown, and at the end the page is refreshed.

But I want to be abel to add new objects with some javascript click-s without calling 2sxc edit popups.


edited (added):

To add object with javascript and WebApi I use this code:

$2sxc(moduleId).webApi.post('app/auto/content/objname', null, { Title: 'Title of new object' });

What code I can use for update the same object?

I tried that way (eg. 2000 is entityId of the object I want to update):

$2sxc( moduleId).webApi.post('app/auto/content/objname/2000', null, { Title: 'Updated name' });

But it crate new object with new title and new entityId but the same entityGuid? What I am doing wrong?


Edited:

is posible that this is the same problem?

https://github.com/2sic/2sxc/issues/1310


Solution

  • This was bug and it is fixed: https://github.com/2sic/2sxc/issues/1310