This is a long shot.
In perspecive, is there a way to display formatted object like below:
and
What do you mean ?
Display where ? Formatted how ?
Display as is.. in Beautified form, indented at least.
I wanted to show/display recipe..
This recipe can be of different Object structure.
I have no clue what you mean.
Do you want to display it in a view ? In the console ? In logs ?
Of course.
Display in a view.. can be seen on browser screen as is (formatted).
There are a lot of ways to display things in a nice format.
The simplest way might be to just use a label, set whitespace: pre
in its styles, bind its text prop to your data and use a formatting function.
Or you can use a flex repeater to have full control over each item.
I will test.
I have these on Document Tags.
I will bind markdown to this tag, probably need to convert first to string..
Let me see..
Yep, markdown sounds like a good idea.
What did you do to get this ?
The source string come from custom.object
-> converted to json string via system.util.jsonEncode(value, 20)
-> feed this string to Text Area (So I can play with format)
-> feed output of text area to markdown (whitespace: pre)
What format do you want ?
The string initially looks like this:
I had to manually, add newline
and add indent
using Text Area.
Paste your JSON as formatted text so we don't have to type it all out again.
Re-read Pascal's responses and try and answer his questions.
here you go:
{
"sfcNumber": "12345",
"materials": 1,
"requestId": "S0031",
"location": "mpx",
"priority": "Low",
"department": "dept",
"onHoldNotes": "on hold s0039",
"status": "Completed"
}
def transform(self, value, quality, timestamp):
longest = max(len(str(k)) for k in value.iterkeys()) + 2
return '\n'.join("{k:.<{w}}{v}".format(k=k, v=v, w=longest) for k, v in value.iteritems())
Go from there to get whatever result you want. Or describe it if you get stuck.
edit:
Note that you get the exact same thing with a label, so as long as you want something basic, stick with a label.
I now get it.. you need to cook it yourself..
Thanks Thanks Thanks.
Sorry.. But I found this:
But I was unable to make it work yet... Will get back to this..
Ah ! I knew there was something like that but I couldn’t find it. I guess I just missed it… thought I was going crazy and remembering things that didn’t exist !