Cannot retrieve JSON data for the entire jsTree - json

I use the json_data plugin of jsTree.
When I call:
$("#my_tree").jstree('get_json');
the function returns only the JSON data of the currently selected node.
If nothing is selected, then I can get the entire data and that's ok, but if a leaf is selected I only get the JSON part corresponding to the leaf.
What is the way to get always the JSON of the entire jstree?
PS: I don't want to manually deselect the currently selected node. That would be a dirty trick.

Like suggested in the comments I've tried:
$("#my_tree").jstree('get_json', -1);
and that works just fine.

Related

Hide JsonValue from log file using <flter-spec>

I'am trying to hide the Json value of the student field from log files using filter-spec,
this is my filter-spec :
after i applied the flter this is how the data is showing in the log file
all i want it is to replace ("student" : "testStudent") with ("student": "****") instead it is got replaced with ("student: ****)
does anyone have an example on how to hide the json value using filter-spec?
Thanks in advance
It is not actually possible replace a JSON value with a filter. You'd need to use a custom filter or custom handler in order to do this.
You could file a feature request though. It does seem like a decent idea for a filter to be able to filter values in structured formats.

Alpha anywhere: Can I populate JSON data into the list

Can I populate a list with JSON data? I have a general list containing data available for several sessions but I need to filter them with my current session and insert them to another list. My idea is to use the filtered JSON data since I successfully filtered them in JSON format. I've looked into some threads that might relate but currently get nothing. Hope someone can point me to the right page.
I missed this page: or maybe I overlooked it: https://forum.alphasoftware.com/showthread.php?119524-How-to-populate-a-List-from-a-JSON-formatted-field.
Anyway, populating JSON data into list in alpha anywhere is easy to be done. Firstly, get the JSON data(in my case I produce them from another list). With this data(already in JSON format), I do the filter using:
var filtered_json = find_in_object(JSON.parse('my_JSON_data'), {my_filter_condition});
Then, the result should be in [object object][object object]
Finally, populate the result to the list.
var lObj= {dialog.object}.getControl('my_list_ID')
lObj.populate(filtered_json);

How to display returned data json to grid in firemonkey?

I have received data from json web service with RESTRequest component
but I do not know how I should display the returned data in a grid?
How can I use RESTResponseDataSetAdapter to improve this?
Try this - it took me about 15 minutes to get working
Open the RESTDemos in your Delphi install's Samples\Object Pascal\Database\RESTDemo
Drop a TStringGrid on the RHS of the the Delphi-Praxis tab (I chose this one because
the URI on the Fetch to DataSet produces a 404 error).
If necessary, make the non-visual controls on the form visible.
Dbl-click BindingList and use the QuickBindings to add a LinkGridToDataSource. Set its
DataSource to ClientDataSet and its GridControl to StringGrid1. Thus will cause DBSourceDB1 to be created'.
Set the Response property of RestReponseDataSetAdaptor to `RESTResponse'.
Compile, run and click the fetch list of forums button. You should see the StringGrid populates
from the contents of memo_ResponseData
That should show you that LiveBindings can work with a RESTReponse to populate a grid. The RESTDemos demo has a lot more things in it, but if this is your first experience of LiveBindings, you might want to backtrack and try setting up a simple test project which populates a TStringGrid and a few TEdits from a dataset of your own.

using a sort compare function on hierarchical data

I am attempting to use sortcomparefunction to ensure a specific data entry is the last object of its parent. However when using the sortcomparefunction the objects being passed in are always the root object. is there another way i could sort my data to ensure the object named "Upload" is always at the bottom. Just to clarify im trying to sort the data held in objects 1 2 and 3 fo4r example. My data is structured as below
`rootObject -Object1-namedObject1
namedObject2
Upload
Object2- stackObject
Upload
errorprofile
Object3-images
Upload
Video`

Googlechart error on a linechart with tooltip values coming via JSON

I have a google chart and want to add a custom tooltip. I found some great answers like this this site and set about doing this with roles. I also found this link about it and it looked like the best way.
My data is being generated via json and I use a php file to create a json feed. The rows I have coded like this
{"cols": [ {"id":"","label":"Period","pattern":""},
{"id":"","label":"Recorded P/L","type":"number", "role":"data"} ,
{"id":"","label": null,"type":"string", "role":"tooltip"},
{"id":"","label":"Best Available P/L","type":"number", "role":"data"},
{"id":"","label": null,"type":"string", "role":"tooltip"}
]
Then it goes on and adds all the data. The problem is when I try to run this I get the error
All series on a given axis must be of the same data type
I have checked the json and that is formed correctly but am not sure what I could be doing wrong.
At least part of your problem is that you're not specifying the type for your first column.