[ 
https://issues.apache.org/jira/browse/SLING-883?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12680540#action_12680540
 ] 

Rory Douglas commented on SLING-883:
------------------------------------

I think the problem is that non-Sling/3rd party widgets expect the item 
attributes to exist directly on the item, not on an attribute called "content" 
- in particular tables, grids etc.  Perhaps we can rather do the following:

newItem: function(/* Object? */ keywordArgs, /*Object?*/ parentInfo) {
  .......
    var item = keywordArgs;
    delete item.uri;
......

it might also make sense then to use a more obscure naming scheme for these 
internal housekeeping attributes (_uri, or _slingNodeStore:URI), and also allow 
the attribute used to be configurable on the store, to avoid conflicts with 
actual node item names.

> SlingNodeStore.newItem() adds item URI as property
> --------------------------------------------------
>
>                 Key: SLING-883
>                 URL: https://issues.apache.org/jira/browse/SLING-883
>             Project: Sling
>          Issue Type: Bug
>          Components: Extensions
>            Reporter: Andreas Hartmann
>            Priority: Minor
>
> SlingNodeStore.newItem() uses the passed item argument directly to create the 
> Sling resource. Since the item has a "uri" field, the corresponding "uri" 
> property of the Sling resource will be set. This causes an exception if the 
> JCR node type doesn't support this property.
> Maybe it makes sense to use a "content" field inside the item object to 
> provide the content:
>   store.newItem({
>     uri: "/foo/bar/baz",
>     content: {
>       "jcr:primaryType": "foo:bar"
>     }
>   });
> Index: src/main/resources/dojox/data/SlingNodeStore.js
> ===================================================================
> --- src/main/resources/dojox/data/SlingNodeStore.js   (revision 752029)
> +++ src/main/resources/dojox/data/SlingNodeStore.js   (working copy)
> @@ -638,7 +638,7 @@
>      
>      var xhr =  xhr = dojo.xhrPost({
>          url: item.uri,
> -        content: item,
> +        content: item.content,
>          load: function(response, ioargs) {
>            item.dirty = false;
>            console.log("onNew");

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to