Populating grid and form with same json? - json

Is it possible to populate grid with some of the JSON data and a form with other, from the same JSON? Two stores or two models or both? simple example... ;-)

Yes, the best way to do this would be to manipulate the reader, which as well as returning records, also stores whatever the raw json sent from the server is.
The easiest solution would be to specify the reader parameters for your grid, but then have a listener on the store, which then processed the rawData property from the reader to get the additional values for your form.
Of course if your form data is related to the grid data, you may do better to rely on nested loading and form.loadRecord in the store's load event handler. See the Ext samples (form and grid data binding example) for wasy of doing this.
Depending on the circumstances, another approach similar to the Ext FAQ would be to handle the Ajax through a simple Ext.Ajax.Request, and this process the json through two stores with local proxies, but this doesn't seem quite so Ext4 data model friendly to me.

Related

React component: Array structure different to expected

I've written a presentational component (https://github.com/studioraygun/react-dropdown-list) but now I want to use it in another project I've hit a stumbling block.
I want a show a list of data which comes from an API but the data is formatted very differently to what the component expects. I think I have two options:
1) Write a sub-component which lets me generate the actual list using the map function
2) Find a way to "alias" or rename the array keys being sent by the API
Neither approach feels ideal, and I wondered if there might be a more sensible way?

Send custom property with value as JSON array

We want to send some events to Application Insights with data showing which features a user owns, and are available for the session. These are variable, and the list of items will probably grow/change as we continue deploying updates. Currently we do this by building a list of properties dynamically at start-up, with values of Available/True.
Since AI fromats each event data as JSON, we thought it would be interesting to send through custom data as JSON so it can be processed in a similar fashion. Having tried to send data as JSON though, we bumped into an issue where AI seems to send through escape characters in the strings:
Eg. if we send a property through with JSON like:
{"Property":[{"Value1"},..]}
It gets saved in AI as:
{\"Property\":[{\"Value1\"},..]} ).
Has anyone successfully sent custom JSON to AI, or is the platform specifically trying to safeguard against such usage? In our case, where we parse the data out in Power BI, it would simplify and speed up a lot some queries by being able to send a JSON array.
AI treats custom properties as strings, you'd have to stringify any json you want to send (and keep it under the length limit for custom property sizes), and then re-parse it on the other side.

ExtJS: Loading data into multiple combobox from a single json using nested model

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.

Handle variable number of dynamic input fields in ASP.NET MVC?

I've done a lot of C# programming but I haven't touched much web until recently. One thing I've been struggling a little bit with, and really think there must be a better way I don't know about, is the right(a few of the better ways?) way to send the data in a form to a server.
I'm using MVC4 / C #, and I'm working on an html form that will be at least 18 inputs, some with multiple selections, and the ability for users to click 'add another' to a certain spot, and could make the amount of input fields 30+.
Is there any neat way to package this into some sort of javascript object, and receive it as a object in c#?
I would prefer to not do a post with the form, since I want to use AJAX and not have the page refresh.
In the only other form I have done so far in this project, there was about 6 inputs, but each one was optional. I built a queryurl and used jquery. Just this seemed like more of a pain than it needed to be and it's much smaller.
$.get(apiLink, function (response) {
$("#SearchResults").html(response);
});
You can create a JSON object with all the inputs you have, and then parse it on your controller using JSON.NET

Best practices to produce JSON from NotesViews or DocumentCollections

I'm working on a custom control that will be fed by JSON content and I'm trying to find the best approach to produce and consume it.
Let say the JSON could be from:
Notes View (all documents)
Notes View (subset of documents based on a category or filter)
Notes Document Collection (from database.Search or database.FTSearch)
What I have on my mind is to define some Custom Properties where I can define:
URL that produces the JSON
Object
etc.
So far I'm considering:
REST Service control from ExtLib
XAgent that produces JSON
Domino URL ?ReadViewEntries and OutputFormat=JSON
Does anyone knows if the JSON object loaded in memory has a size limit?
Any suggestion will be appreciated.
Definitely go for the REST Service control from the Extension Library, offers by far the best combination of flexibility vs performance vs development time.
Matt
What about creating the JSON in the view itself and then just read the column values? http://www.eknori.de/2011-07-23/formula-magic/
If you want to parse the json object using ssjs, you can fetch it using an URLConnection and put the resulting object into a repeat control using the eval statement.