I have successfully display my JSON data into an accordion but my problem was that I can't find the way to get the final data after modification :( .
this is the source code link :
https://stackblitz.com/edit/material-expansion-panel-drag-drop-multi-level-qrdusr?file=src%2Fapp%2Fapp.component.html,src%2Fapp%2Fapp.component.ts
You need to wire your inputs to a FormControl/FormGroup so you can keep track of the values https://angular.io/guide/reactive-forms
Related
I have the following scenario:
I have two comboboxes, with different root property.I want to load both comboboxes using same response.
Please provide some solution to accomplish this.
You can refer the fiddle for clear understanding.
https://fiddle.sencha.com/#fiddle/fti
I want to load first combobox with "RetrieveRegionComboList" and second combobox with "RetrieveLanguageComboList", by loading the json only once.
In this fiddle,Iam populating the combobox by making call to JSON twice using nested store in model. I want to achieve the same by using the single response to complete multiple request.
Thank You...
You can load the data in both combos like this :
First, you make an Ajax request, and in the success callback you decode the JSON and load the data into the stores.
I am getting a JSON file from an URL which contains some movie data.
http://movieapp-sitepointdemos.rhcloud.com/api/movies
I have checked in Postman it works fine and showing data also. But when I try to show data on angular using ng-repeat it does not show.
Please check why data is not displaying on it.
Here is my plunker
thats because in your movies object contains only {"message":"Movie Added"} object
here you can see example, ive updated , ng-repeat works as expected in another batches object , and also you can see what you get from server at the first line
I've recently taken a dive into ExtJS by inheriting a web app written in 3.4. I've managed to create a store attached to a grid with no problem and have been able to bring up a PanelForm with data loaded from a call to a php page.
I have another json store defined which doesn't get populated when I call its load procedure and I'm wondering what I am missing.
The definition of the store is below:
var ImgStore = new Ext.data.JsonStore({
totalProperty: 'total'
,root: 'data'
,url : 'json/getProductImage/'
,fields : [{
name : 'img'
},{
name : 'extn'
}]
});
My code to load the data is:
ImgStore.load({callback: function() {}
,params: {'ProductGUID': x}
});
The code behind the URL is fine and the response in Firebug below:
{"success":true,"data":{"img":"iVBORw0KG...ggg==","extn":"png"}}
What I cannot understand is why the response comes back but the Store does not populate. I must be missing something; I just can't see what...
Does the Store have to be bound to another object? What I wanted to do was to read back the base64 encoded string and then show the image on screen (on either a panel, FormPanel or Container; not really sure of the best method really)
Any advice is greatly received.
Your store needs a model. The model needs to reflect the attributes that are then being returned in your JSON feed. Only then will the data show up in your store.
Everything looks fine, except for the url config aren't u missing the name of the file ? 'json/getProductImage/myfile.json'?
How are you validating store is not loaded by binding it to a grid? Because if so, store could be loading but not configuring grid properly might make u think store is not loaded, try console.log(store.getTotalCount())
I am fairly new to JSON and I want to create a choropleth example as so. http://gabrielflor.it/a-half-decade-of-rising-poverty Whenever the years are clicked it just goes to a different portion of the JSON (I'm assuming). Is this how functionality like this is usually done to avoid redrawing the whole map again and calling another JSON.js file? If so these .JSON files can get quite large?
Using a JSON is only a way to store values you need for each year. When you switch to another year the JS parse the JSON for the giving year and update the choropleth. For the example you have provided, here is the JSON used:
http://gabrielflor.it/static/data/saipe.json
This is a good way since you only have one JSON with every year you need and you load it only once. However since d3 needs datas this way I think you should add another JSON if you want to provide additional data like in gabrielflor example:
http://gabrielflor.it/static/js/d3.poverty-by-county.js?v=121107
He loads JSON like this with d3:
d3.json('../static/data/states.json', function (json) {
states = json;
});
or
d3.json('../static/data/saipehighlights.json', function (json) {
saipehighlights = json;
});
If you look at the network traffic for the example page you gave (ex. by using Chrome Developer Tools).
The file with the poverty data is quite large, but the mapping data file is even larger. You'll notice, that it takes longer for the website to load, but afterwords it runs very smoothly in the client without making any server calls.
The site is just about browsing information and nice design - for that purpose I think a longer load time is quite acceptable if the user experience after is smoother(i.e. user doesn't have to wait for year data to load).
I'm trying to use the jquery-ui autocomplete and I'm having trouble fully understanding how to hook it up.
In an effort to see functionality, we exported a list of user names in the json format of
["Abbott, Bob",
"Adams, Jo", etc...
and it's over 8k lines. I saved this into a file called names.json. When I set up my autocomplete, I used the following:
$("#userName").autocomplete({
source: "names.json"
});
Based on the jqueryi-ui autocomplete page. It says this:
When a String is used, the Autocomplete plugin expects that string to point to a URL resource that will return JSON data.
It returns all 8k+ names instead of filtering it based on what I'm typing. I tried changing it to:
$("#userName").autocomplete({
source: "names.json?term="
});
That didn't work to filter it either.
I've tried variations on the remote JSONP datasource example, but I can't seem to get it to work.
I've tried changing my json file to the format of:
[{"value":"Abbot, Bob"},
{"value":"Adams, Jo"}, etc...
That didn't filter.
I've tried taking out the quotes around value. That didn't return anything.
I've tried changing it to the format listed in the answer for this stackoverflow question returning item.value with my second json format but that didn't filter it either.
I'm not quite sure what I'm doing wrong and I hope to understand. Thank you.
Your datasource needs to by dynamic.
jquery ui autocomplete is going to send a request to the URL you have specified with ?term=WHATEVER_THE_USER_TYPED appended. You need something on the server side that will process that request and return just the data for that term.
For instance,
$("#userName").autocomplete({
source: "names.php" // php as an example.
});
Will result in a request to:
/names.php?term=abcd
names.php would have to pull back the data that matches the search and return it.