Using this awesome package however having a little weird issue. So I have a property editor custom one that populates a drop down. All works fine when property is added to a doctype.
I have created a new doctype and added same property and enabled use of that doctype in the grid. When you try adding content the following js code in the controller does something strange:
// Use the current page id. If the current page is a new page
// then use it's parent id
var id = editorState.current.id > 0 ? editorState.current.id : editorState.current.parentId;
The weird thing is when this property is used in grid the first line always returns -20 stepping through with chrome debugger editorState.current.id is always 0 and hence it tries to get parentId that returns -20
So after speaking to Matt looks like at this point the editorstate is being set a node that does not exist, doctype grid editor uses doc type to define what we will use in the grid but we never create content using it hence it has no value.
So question now is in my controller is possible in another way to get the node id of the current page?
In in answer to my own question i have a work around,
if (id === -20) {
//we are grid and working with virtual node hence we have no id as we have no node
//hence get id from query string
var url = window.location.href;
var urlArray = url.split('/');
id = urlArray.slice(-1)[0];
}
editor state id or parentid incorrect value
Guys,
Using this awesome package however having a little weird issue. So I have a property editor custom one that populates a drop down. All works fine when property is added to a doctype.
I have created a new doctype and added same property and enabled use of that doctype in the grid. When you try adding content the following js code in the controller does something strange:
Then further down we have
The weird thing is when this property is used in grid the first line always returns -20 stepping through with chrome debugger editorState.current.id is always 0 and hence it tries to get parentId that returns -20
Any ideas? This is with umbraco 7.2.8
Cheers
Ismail
So after speaking to Matt looks like at this point the editorstate is being set a node that does not exist, doctype grid editor uses doc type to define what we will use in the grid but we never create content using it hence it has no value.
So question now is in my controller is possible in another way to get the node id of the current page?
Regards
Ismail
In in answer to my own question i have a work around,
Also Matt has raised issue on issue tracker http://issues.umbraco.org/issue/U4-7466
Regards
Ismail
is working on a reply...