I've created a property editor which stores it'a value as json. (http://our.umbraco.org/projects/website-utilities/ksumbraco7calendar)
If I select to show this data type in the list view the whole json is viewed. Is it possible to define a property from the json to view in the listview? The json would look something like this: {"recurrence":"1","weekInterval":"1","monthYearOption":"1","interval":"1","weekDay":"1","month":"1","monthOption":"1","startDate":"2014-12-22
21:00","endDate":"2014-12-23 21:00"}
I am making a custom propery editor, which stores its value as JSON.
Using the new List view in Umbraco 7.2.1 it's possible to add custom columns to the list view.
I am wondering if it's possible in a custom property editor (e.g. in the package.manifest) to define a value to show if the data type is viewed in the list view as a custom column.
No, I haven't found any solution to this yet. On the old download-page I read that in version 7.3 it sould be possible to sort by custom properties. (Ref.: http://issues.umbraco.org/issue/U4-6003)
So I will wait until that release to see whats possible. An alternative for me is to save one JSON-attribute in an other property type and sort by that.
That's right. But it's one step in the right direction... So I will wait and see what possibilities that will bring. Maybe an event to hook into or something.
I have the same problem like you guys but it seems that the solution for this isn't here. I searched in the URL Markus posted to but no luck..
I use the Umbraco Gmaps plugin which has some great solution to choose a specific place in a nice way..
I then use this method in a list view with items who has their own "google maps" property.
I then wanted to sort all the items by address and city in the list view, see the screenshot down below:
Here I have the google maps data property in the list view, it's returning everything in a JSON string..
I don't know how to the extract address and city.. Any idea? Did you find a way? I know this post is like 6 years old, but I'll give it a try! :D
Hi,
What I did was to create another property on the document type, eg. a label.
Then I wrote some code that extracted the value I wanted to show in the listview and saved it to that label.
Here is some sample-code. I haven't tested this exact code, and you will have to edit it to suit your needs and aliases.
public class CustomEventHandler : ApplicationEventHandler
{
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
ContentService.Saving += ContentService_Saving;
}
void ContentService_Saving(IContentService sender, Umbraco.Core.Events.SaveEventArgs<IContent> e)
{
if (UmbracoContext.Current == null) return;
foreach (var node in e.SavedEntities)
{
try
{
if (node.DocumentTypeAlias == "YourDocumentType"))
{
var value = ""; //Extract the address here...
node.SetValue("LabelField", value);
sender.Save(node, currentUser?.Id ?? 0, false);
}
}
catch (Exception ex)
{
LogHelper.Error<CustomEventHandler>("Could not save events for node.", ex);
}
}
}
Value from json property editor in list view
Hi!
I've created a property editor which stores it'a value as json.
(http://our.umbraco.org/projects/website-utilities/ksumbraco7calendar)
If I select to show this data type in the list view the whole json is viewed. Is it possible to define a property from the json to view in the listview? The json would look something like this: {"recurrence":"1","weekInterval":"1","monthYearOption":"1","interval":"1","weekDay":"1","month":"1","monthOption":"1","startDate":"2014-12-22 21:00","endDate":"2014-12-23 21:00"}
And i would like to show the value for startDate.
Thanks!
Ole Martin
Hi Ole Martin,
If I understand your questions correctly then you are using the http://our.umbraco.org/projects/website-utilities/ksumbraco7calendar package on your project and now you want to display the start date value.
Did you see the pdf with the documentation if not take a look here /FileDownload?id=12113, there is an example on how to show the start date.
Hope this helps,
/Dennis
No, I'll try to reformulate the question.
I am making a custom propery editor, which stores its value as JSON.
Using the new List view in Umbraco 7.2.1 it's possible to add custom columns to the list view.
I am wondering if it's possible in a custom property editor (e.g. in the package.manifest) to define a value to show if the data type is viewed in the list view as a custom column.
Any solution to this issue so far?
No, I haven't found any solution to this yet. On the old download-page I read that in version 7.3 it sould be possible to sort by custom properties. (Ref.: http://issues.umbraco.org/issue/U4-6003) So I will wait until that release to see whats possible. An alternative for me is to save one JSON-attribute in an other property type and sort by that.
That's sorting by the property - but nothing about fetching a property from a json-blob?
That's right. But it's one step in the right direction... So I will wait and see what possibilities that will bring. Maybe an event to hook into or something.
Did you post anything on issue.umbraco.org for this? I can do that otherwise?
No, I didn't. If you do, please post the url/issueno here, so I can follow it.
Here: http://issues.umbraco.org/issue/U4-6706
Please add info and vote =D
Hey!
I have the same problem like you guys but it seems that the solution for this isn't here. I searched in the URL Markus posted to but no luck..
I use the Umbraco Gmaps plugin which has some great solution to choose a specific place in a nice way..
I then use this method in a list view with items who has their own "google maps" property.
I then wanted to sort all the items by address and city in the list view, see the screenshot down below:
Here I have the google maps data property in the list view, it's returning everything in a JSON string..
I don't know how to the extract address and city.. Any idea? Did you find a way? I know this post is like 6 years old, but I'll give it a try! :D
Best regards,
Simon
Hi, What I did was to create another property on the document type, eg. a label. Then I wrote some code that extracted the value I wanted to show in the listview and saved it to that label. Here is some sample-code. I haven't tested this exact code, and you will have to edit it to suit your needs and aliases.
}
is working on a reply...