Build a new shop using a section of data from a JSON database

Let's say I have a JSON store that is set up as shown below

var subAccountStore = new Ext.data.JsonStore({
  autoLoad: true,
  proxy: {
    type:'ajax',
    url : '/opUI/json/subaccount.action?name="ABC"'
  },
  fields: ['accountName', 'quantity','accountNumbers'],
  listeners: {
    load: function(store, records, success) {
      // ???????
    },
    single: true
  }
});

Here is an example of the data in this store:

[{"accountName":"'ABC'","quantity":100,"accountNumbers":['12345A','12345B','12345C']},{"accountName":"'XYZ'","quantity":100,"accountNumbers":['99999A','99999B','99999C']}]

I am wondering how to dynamically create a store for accountNumbers and then assign it to a combo box within a grid?

Thank you, Tharahan

Answer №1

To properly handle account numbers, a separate store needs to be declared. This is exemplified in the panel items below:

items: [{
xtype: 'combobox',
id: 'addObjectComboCopy',
fieldLabel: '<h style= "color:red;">*</h> accountNumbers',
store: addFormStore,
displayField: 'select',
valueField: 'name',
editable: false,
allowBlank: false

}]

In order to declare the Store correctly, it should follow the structure outlined here:

var addFormStore = Ext.create('Ext.data.Store', {
fields: ['name', 'select'],
data: [
    {"name": "01", "select": "12345A"},
    {"name": "02", "select": "12345B"},
    {"name": "03", "select": "12345C"}
]

});

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to configure a basic firebase ajax call?

I wanted to explore using AJAX instead of set to interact with Firebase. However, when I attempted to do so with the code below in my test.html file, I encountered an error message in the console: XMLHttpRequest cannot load . No 'Access-Control-Allow ...

Steps for importing a React component as an embedded SVG image

I have developed a SVG component in React by converting an SVG file to a React component using the svg-to-react cli tool. In order to load and display additional svg files within this component, I am utilizing the SVG image tag as demonstrated below. This ...

Exploring the Function Scope within ViewModel

I have been facing an issue while trying to call a function from my ViewModel within a foreach loop. It seems like the function goes out of scope as soon as I call it. Being new to JavaScript, I am struggling to understand why this is happening. Here is t ...

Tips for accessing child elements within an Angular component

I'm struggling to get a reference of child elements within a component. I have experimented with ElementRef, TemplateRef, QueryList, ViewChild, ViewChildren, ContentChild, and ContentChildren without success. <app-modal> <section #referenc ...

The function app.post in Express Node is not recognized

I decided to organize my routes by creating a new folder called 'routes' and moving all of them out of server.js. In this process, I created a file named 'apis.js' inside the routes folder. However, upon doing so, I encountered an error ...

A guide to updating property values in an array of objects in JavaScript while ensuring they remain in consecutive order

I am dealing with an array of objects called list. The parameters rid and rorder are provided for processing. -> 1. Whenever the value of rid matches the id in the list, the itemorder is updated with the value of rorder. -> 2. In the updated list p ...

The reason behind the successful execution of the final .then in promise chaining

I am new to JavaScript and have encountered an interesting problem with the following code. Even though I haven't returned anything from the .then method, the last .then (blue color) works instead of the first one (red color). Can someone explain why ...

Discover anew the means to revive JavaScript and Ajax call towards the controller without necessitating any user click within the captivating Razor View of MVC 4

Controller Action : public ActionResult googlemap() { return View(); } This specific controller action is responsible for rendering the "googlemap.cshtml" view. It makes use of Ajax calls and includes JavaScript code in the "googlemap.csh ...

Implement the useEffect() function to handle the loading of external JavaScript on the client-side, replicating the

I have encountered a challenge while trying to integrate a rich text editor into my NextJS project. Since there are no available React components for this specific editor and it operates solely on the client side, I am required to load the necessary JavaSc ...

Is three too much for the Javascript switch statement to handle?

I'm a beginner in Javascript and am working on a project to create a fun program involving astrological signs, planets, and houses to generate a story. I have included three switch statements within one function to accomplish this. I'm encounter ...

Using a responsive menu (mmenu) can lead to an increase in Cumulative Layout

I've implemented mmenu as a responsive menu on my website. Recently, I discovered errors in Google's search console related to high CLS (Cumulative Layout Shift). Upon further investigation, I noticed that when loading my page in "slow" mode for ...

Remove any errors as soon as the input field becomes valid

My current setup involves AngularJS with node.js. To handle errors, I have devised the following strategy: node router effect.js: router.post('/', function(req, res, next){ req.checkBody('name', 'Eff ...

Issue: ArrayBuffer failing to function properly in conjunction with Float64Array in NodeJS

Having some trouble with getting a Float64Array to work with an array buffer in Node. Here's what I've tried... var ab = new ArrayBuffer(buffer.length); var view = new Uint8Array(ab); console.log(view.length);//prints 3204 However, when I try ...

Utilize Node.js driver to export a Mongo collection into a JSON file

How can I export a MongoDB collection to a JSON format using the Node.js driver and fs.writeFile? ...

Ways to extract information from a JSON request

Hey there, I'm new to this and still figuring things out. I'm looking to extract data from the following: { "list": [ { "brewery":"Strangeways", "beer":"Albino Monkey" }, { "brewery":"St. Bernardus", "beer":"Pater 6" } ] } Here' ...

What is the appropriate utilization of the await keyword within concise if-else statements in JavaScript?

Along with transitioning away from jQuery, my main focus is to make my code more efficient. In large scale enterprise applications, the excessive use of jQuery and JavaScript can become problematic. I have decided to switch back to vanilla JavaScript for ...

Retrieve a JSON response from within a schema housed in MongoDB

I have a document structure that looks like this: { "id": "someString", "servers": [ { "name": "ServerName", "bases": [ { "name": "Base 1", "status": true }, { "name": "Base 2", ...

Tips for transforming a DataFrame into a nested JSON format

I am currently in the process of exporting a dataFrame into a nested JSON format for D3.js. I found a helpful solution that works well for only one level (parent, children) Any assistance with this task would be greatly appreciated as I am new to Python. ...

Google Chart Fails to Display

I am encountering an issue while attempting to integrate a Google chart into my project. The page fails to load, rendering a blank screen. Initially, the page displays correctly for a brief moment after loading and then suddenly turns blank, becoming unres ...

Ways to store debug logs in a file within my project

In the project I am currently working on, I incorporate the Debug package which can be found at https://www.npmjs.com/package/debug. As part of this setup, I have set an environment variable (variable name: DEBUG & value:*). As a result, I am able to vie ...