Add data to canvas div's by clicking on rectangle - javascript

http://fiddle.jshell.net/f6rLds4g/
I have put the data in div's manual (just typing 1111, 2222, 333, 4444)
My question is is it possible to get data from JSON (which i tried but failed - I think the mistake is on me). I searched for answers on the web but failed to find it.
So if I click on the first rectangle it should give me a data showing in the divs from the JSON file instead of prompt
the JSON is:
{
"name": "1",
"text": "111111",
"version": "1.0.0",
"country": "NL"
}
So instead of just typing 1111 it should put this data in the first div from a JSON file.

Related

Handle data of big JSON file in React

I have big JSON file it is about 4 million line this is structure :
{
"name": "...",
"type": "personal_chat",
"id": 1744378997,
"messages": [
//some data here
]
}
I want make a chat and I have this chat I want to make as JSON file, I want put this data in UI (design) to display it perfectly for user,
Problem: The file is very big as I said it about 4,400,000 line and about 300,000 objects in messages array, How can I load data when user is swipe up because it's impossible to put all this data when user is open website
The last object in messages array should put in the first of the chat. It is the last message!

A little help need with JSON format (text from prismic output to Angular)

I am trying to get a Angular based frontend working, but i am having difficulty working with this format. It's html tags are in JSON format and am wondering how to output them (In Javascript/Angular). Here is a snippet (hope it works):
spans": [ { "start": 63, "end": 70, "type": "strong" } ] }, { "type": "paragraph", "text": "Notice how the tag bar transforms into a formatting toolbar when you're writing in this editor. Now, this might look like a wysiwyg, but this is actually not your average wysiwyg, as it stores structured content, and not HTML. It allows you to build your content in better ways as you type it, making it easy for you to present it in various ways later.", "spans": [ { "start": 41, "end": 59, "type": "strong" } ] }
Anybody has any experience with this? I would like to know how to "crawl" this JSON document to output (for example the spans) to HTML.
Thanks!

How do I occupy a textbox with this JSON data

I am currently using JSON, AJAX, JQuery, and javascript. My JSON look like this
[{[{
"eventName":"Event Name",
"operationgDivision":"Operating Division",
"startDate":"05/14/2014",
"endDate":"05/19/2014",
"siteStartDate":"05/14/2014",
"siteEndDate":"05/19/2014",
"relatedEventName":"Related Event Name",
"relatedEventStartDate":"05/14/2014",
"relatedEventEndDate":"05/19/2014",
"objective":"Objective Info",
"targetAudience":"Target Audience",
"howToReachTargetAudience":"How to reach target audience",
"singleMessageToCommunicate":"Single message to communicate",
"challengesToConsider":"Challenge to consider",
"creativeConsideration":"Creative Consideration",
"creativeConsiderationAttachement":"",
"competitiveConsideration":"Competitive Consideration",
"competitiveConsiderationAttachement":"",
"pOSStartDate":"05/15/2014",
"pOSEndDate":"05/19/2014",
"ID":1
}]
I am currently trying to set the value of the my txtEventName textbox to the eventName data that is within the array in my callback.js file, but I'm having difficulty. Any help would be appreciated.

ExtJS manipulating propertygrid source information

I'm using a propertygrid in a similar fashion to a form, rendering a button in the propertygrid tbar to generate an AJAX request, passing the source information to a back-end function that runs a SQL script.
The process of getting the source information to the back-end is proving troublesome, however; while looking at the information in the browser debug console, the result looks like it can be iterated (sample info from console below):
[CNC: "", Cutter_ID: "", Dimension: "", ID: "71",
Internal_Finish: "Standard White", Item_No: "4", Material_ID: "N/A",
Production_Item_Type_ID: "Frame(s)", Production_Notes: "", Qty: "1",
Ready_by_Date: "31 Dec 2014", Survey_Notes: "",
Thickness_Depth: "95", Type_of_Work_ID: "Complete New"]
Selecting individual items can be done, i.e. I can get and set source['Qty'], for instance.
I cannot, however, pass the information in a manageable format; neither can I encode (or decode) the information from the source to JSON.
I would like to at least iterate through the source and append the information to a string, which is then encoded to JSON to pass to the back-end.
How does the propertygrid source work as a data source, since I clearly don't understand it correctly? What method can I employ to generate JSONable information from it?
Property grid's getSource method returns the source as an object, loop through it to append information
Sample fiddle here: https://fiddle.sencha.com/#fiddle/58o

Retrieve the value from a JSONP formatted data object

Just when I think I've got he hang of identifying an element in an object, I run into a scenario that I cannot seem to get the value I want.
This part works and the data returned is correct: I have a map and when I attempt to identify a building on the map, I receive the following json object (this has been shortened for readability but in real life, its properly formatted): The function MapClick(queryResults) is called when the map is clicked.
dojo.io.script.jsonp_dojoIoScript19._jsonpCallback({
"results": [
{
"layerId": 5,
"layerName": "Building",
"value": "Name of item clicked",
"displayFieldName": "name",
"attributes": {
"ID": "123",
"name": "Name of item clicked",
"Variable1": "Some bit of information",
"Variable2": "Some other bit of information",
...
...
All I'm trying to do is return either the results[0].value OR results[0].attributes.name which in this example should bring back "Name of item clicked". The layerId, layerName, value, and displayFieldName are the "common most accessed data" so they are returned but the same information is also found within the attributes.
I've tried console.log(results[1].attributes.name); and console.log(results) with no success.
Turns out the name of the function handling the MapClicked is queryResults was needed so the correct answer is: queryResults[0].value and when you see open brackets [, you can be sure you will need [ some number ] (e.g. queryResults[0].value or queryResults[99].someothervariable. Or at least I think this is a correct statement.

Categories

Resources