-
Notifications
You must be signed in to change notification settings - Fork 12
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
Trying to Use GridDataModel.Deserialize(json) #42
Comments
@jasonhilldm please remember to provide more than the bare minimum of information. Like what version of Umbraco and the package you're using. And what you're trying to do. |
Sorry…it’s the latest version of the package 5.0.2 and using Umbraco Heartcore with the Umbraco.Heartcore.Client.Net library for retrieving data from the API. I am retrieving content from Umbraco which has a grid property with the grid json. the documentation mentions being able to call GridDataModel.Deserialize(json) but this method is not found on the GridDataModel. |
I'd imagine there are certain things that won't work when using the package outside of Umbraco. Eg. when working with a .NET frontend in a headless setup. To answer your question, the package now has an The package isn't really designed to be used outside of Umbraco, but I suppose you could write your own implementation for |
Hmmm...sounds like it's going to be tricky to get this working with Heartcore. Are you aware of any other packages that provide strongly typed grid support for Heartcore? |
I haven't used Heartcore, but I'm fairly certain there isn't a package that provides strongly typed models outside of Umbraco. But you should be able to copy Umbraco's build in models from here: The overall model for the grid is the It's however worth mentioning that Umbraco's models only cover the "outer" grid structure, and only exposes the value of each grid control as a My package provides strongly typed models for the control values as well - at least for the build in grid editors. But then also a system for adding your own models for custom grid editors. This is why it - among other things - needs the |
Thanks for your help. I was trying to use a custom JsonConverter to deserialize the values from individual grid controls into the correct control types but I couldn't get it to be called when using the .Net client library methods to fetch data from Heartcore, e.g. ContentDeliveryService.Content.GetByUrl(). I added a JsonConverter attribute to my GridControl class but this was not being called during deserialization. Do you know if it's possible to use custom JsonConverters in this way? |
This depends a lot of the rest of your code around the grid. I think it should be possible to handle via a custom JSON converter for the grid control. But it might be hard getting to work with a JSON converter on the models for various grid control values. |
I have installed the nuget package but the GridDataModel doesn't seem to have a static Deserialize method. How do I get access to that?
The text was updated successfully, but these errors were encountered: