Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data List - Preview of Umbraco Content data source with $ parameter #120

Closed
bjarnef opened this issue Jun 24, 2021 · 5 comments
Closed

Data List - Preview of Umbraco Content data source with $ parameter #120

bjarnef opened this issue Jun 24, 2021 · 5 comments
Assignees
Labels
feature-request New feature request umbraco A concern for Umbraco wont-fix This will not be worked on

Comments

@bjarnef
Copy link

bjarnef commented Jun 24, 2021

Is your feature request related to a problem? Please describe.

When using Umbraco Content as data source is seems it doesn't show preview of the data like a custom data source.

Would it be possible to show a preview of this? It would be okay to limit the results if there are many nodes, but nice to visualize the Xpath query works 😁

image

@bjarnef bjarnef added the feature-request New feature request label Jun 24, 2021
@leekelleher
Copy link
Owner

@bjarnef It will show a preview, but depends on the XPath expression used. If it's contextual, e.g. starts with one of the $ parameters, then DataType has no context of that - as it's not in the Content tree.

For explicit/absolute XPath expressions, it will show the preview.

@bjarnef
Copy link
Author

bjarnef commented Jun 25, 2021

@leekelleher the XPath used is $site//brandArchive which has some Brand Page child nodes.

Some months ago a made this PR umbraco/Umbraco-CMS#10049 to Umbraco as I noticed using XPath in MNTP didn't worked well in media and member section because it didn't know about the current site/root node, but if only a single root node exists it could be enhanced a bit 😎

I guess it could do some extra check on if only a single content root node exists - otherwise it is okay just to leave empty preview.

@leekelleher
Copy link
Owner

leekelleher commented Jun 25, 2021

My code is piggy-backing on Umbraco's UmbracoXPathPathSyntaxParser.ParseXPathQuery method. So for the $site parameter, it there still needs to be a contextual Content node ID in order to traverse the tree.

Alternatively, if you do only have a single root node (e.g. level 1), then you could amend the XPath to use $root/*[@level=1]? or because you're doing a descendants selector, go straight with $root//brandArchive? (though I prefer explicit naming, e.g. $root/descendant::brandArchive[@isDoc]). That should give you a preview of the data-list items.

@bjarnef
Copy link
Author

bjarnef commented Jun 25, 2021

Okay thanks for the explanation @leekelleher
It works fine with $site variable in the XPath, so just more curios if there was a way to hack it in case only a single root node is available in content section 😁

So not that important and if there is no easy way to make that work, it is just the way it is! 😅

@leekelleher
Copy link
Owner

Yeah, I did look at various ways to make the preview work with contextual XPaths, but it became one of those things were I'd be adding more code to fulfil an edge-case, so I parked it.

I'll close off this ticket and add it to the Known Issues on the README. 👍

@leekelleher leekelleher changed the title Preview of Umbraco data Data List - Preview of Umbraco Content data source with $ parameter Jun 28, 2021
leekelleher added a commit that referenced this issue Jun 30, 2021
Added known issue about Data List preview for
Umbraco Content XPath using `$` parameters. #120
@leekelleher leekelleher added umbraco A concern for Umbraco wont-fix This will not be worked on labels Nov 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature request umbraco A concern for Umbraco wont-fix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants