Establishing a new store instance with Extjs version 2.3.0

I'm facing an issue with creating a new store instance for a combobox in Extjs 2.3.0. The usual method Ext.create('My.Store') doesn't seem to work in this version.

Here's what I've tried so far:

var comb= new this.combobox1.store; // Throws error "store is not a constructor"

and

var comb= new this.combobox1.getStore(); // com is undefined here

If you have any ideas or solutions, please share. Thank you!

Answer №1

It may be a year late, but as they say, better late than never. I stumbled upon this unanswered question and thought I'd share a solution:

To begin, create your store:

 const myDataStore = Ext.create('Ext.data.Store', {
     storeId:'myDataStore',
     fields: ['name', 'value'], 
     data: [
         {'name':'item1', 'value':'value for item 1'}, 
         {'name':'item2', 'value':'value for item 2'}, 
         {'name':'item3', 'value':'value for item 3'}, 
         {'name':'item4', 'value':'value for item 4'}  
     ] 
 });

Next, in the configuration for your combo, assign the created store. The following panel (fp) is a basic form to showcase the sample combo.

const fp = {
  xtype      : 'form',
  frame      : true,
  labelWidth : 110,
    items: 
     {
         xtype: 'combobox',
         fieldLabel: 'Custom Combo',
         displayField: 'name',
         width: 320,
         store: myDataStore, // ASSIGN STORE TO COMBO
         queryMode: 'local',
         typeAhead: true,
         emptyText : '-select-',
         listeners : {
          //add item selection click events here
        }
    }

}

Create a window to contain the panel

new Ext.Window({
      title   : '',
      layout  : 'fit',
      height  : 180,
      width   : 320,
      border   : false,
      items   : fp
}).show();

Check out the working example on Fiddle:

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

Does AngularJS really allow for seamless event communication between modules?

I am in search of a solution to effectively send an event from one Angular module to another. After browsing through various resources, I stumbled upon a thread that perfectly outlines the solution I had in mind. The thread titled How to send message from ...

Is there a way to clear or reset the previous values set in addEventListener?

Imagine a scenario where you have an event calendar, and when you click on an event, a modal window pops up with various buttons. The issue here is that although the code works, when I click on different events, the values of previously clicked events are ...

Is there a quicker method for toggling the visibility of an html element?

Is there a more efficient method to show/hide over 20,000 DOM elements? I've noticed that using element.style.display = "none" is very slow. I suspect this is due to too many reflows in the browser. However, simply using element.style.visibility = ...

I am attempting to monitor the addliquidity event on Uniswap's router02

I am currently attempting to monitor addliquidity events in order to extract data on newly added pairs const Web3 = require('web3'); const NODE_URL = "https://mainnet.infura.io/v3/d3c5832256754c85be86b4c97de2d3d3" const web3 = new We ...

How can I upload a folder with subfolders and keep the structure intact?

I'm working on a form that allows me to upload a folder containing both files and subfolders with more files inside. I managed to upload the folder successfully, but when I check my directory, all the files are in one folder without the subfolders. My ...

Issue with default behavior of infinite scroll in Angular 4

I'm currently working on incorporating infinite scroll into my Angular 4 application. I've carefully followed all the guidelines provided on https://www.npmjs.com/package/ngx-infinite-scroll According to the documentation: By default, the dir ...

Having trouble with validation messages not displaying correctly in Angular after removing a value. What is the correct approach to fix this issue

I've encountered an issue with Angular validation where it's triggering validation on page load, which is not desired. Additionally, when I enter a value, the validation message disappears, but if I return to the textbox and delete the input, the ...

The Dropdown Menu and Slick Gallery are not intersecting

In my jQuery Slick Gallery, I have a Dropdown Menu that displays an unordered list of menu entries when a button is clicked. The issue I am facing is that the unordered list is hidden at the bottom edge instead of appearing above the dots as intended. You ...

What is the proper syntax for using .focus() with the nextElementSibling method in typing?

As I strive to programmatically shift focus in my form using nextElementSibling, I encounter a challenge with typing variables/constants due to working with Typescript... I have managed to achieve success without typing by implementing the following: myF ...

Algorithm for maximizing storage capacity in MongoDB databases

I'm currently facing a challenge in implementing a query that is straightforward in functional programming languages but proving to be tricky in a Mongo Query. The term I've come across for this scenario is "Max Hold": I attempted to use a mon ...

Is it possible for me to retrieve the error message from my response?

Currently, I am working on displaying backend error messages on the frontend. My approach involves sending a response with an error code and message, then setting a state in my React component to display the error message. While I can successfully display ...

A guide on eliminating null or empty values within a React table's map

Is there a way to determine if the value of {row.storeId} is null or empty? If it is, I would like to display NA within the <TableCell>. {props.tableData.map(row => ( <TableRow key={row.storeId}> <TableCell>{row ...

MongoDB has encountered an issue where it is unable to create the property '_id' on a string

Currently, I am utilizing Node.js and Express on Heroku with the MongoDB addon. The database connection is functioning correctly as data can be successfully stored, but there seems to be an issue with pushing certain types of data. Below is the database c ...

Encountering a "window not defined" error while implementing Leaflet in my Nuxt JS application

I'm encountering an issue while trying to generate my nuxt app, specifically on my 'Area' page. It seems like the error is related to the leaflet maps being used on this page. https://i.sstatic.net/Cj9ai.png Initially, I attempted to resol ...

What is the best approach to designing a dynamic class toggler for a React sidebar?

I am trying to add a specific class to a clicked link within a sidebar. While this works for one link, when I attach the handler to another link and click it, both links get assigned with the new class. Is there a way to make this functionality more like ...

Encountering an issue while attempting to utilize the request.js library in a Node environment

I am experimenting with implementing request.js in my node/express application. However, whenever I execute the command node post.js, I encounter the following error: events.js:160 throw er; // Unhandled 'error' event ^ Error: Invalid proto ...

Error: In nodejs express, the reference to 'next' is not properly defined

My challenge lies in managing the input data received from a form using joi validation. I have implemented a middleware called validateCampground to validate the input, but encountered an issue when attempting to define the next function for the subsequent ...

What is the best way to manage sessions in angularjs using javascript?

Only at two specific instances in the application should the login prompt be displayed: When trying to access a page that requires login while not logged in, such as my profile page. When attempting an action that necessitates ...

Customize the keyboard on your iPod by replacing the default one with a

Looking to customize the iPOD keyboard to only display numbers, similar to a telephone keypad: https://i.stack.imgur.com/X0L3y.png The current iPOD default keyboard looks like this: https://i.stack.imgur.com/VykjU.png ...

Creating a custom map using React and Leaflet

Can anyone guide me on creating a map using leaflet? I am encountering the following issue. ./src/Map.js Attempted import error: 'Map' is not exported from 'react-leaflet' (imported as 'LeafletMap'). Below is the code I have ...