Caching JSON requests in ExtJS

Hey there! I'm currently working with Extjs and have created a grid that contains editable cells. One of these cells needs to be a combobox that retrieves its options from a script generating JSON data. The code for the grid and the combobox-cell-editor is functioning, but I'd like to cache the JSON request to the script after the initial call. Is this feasible?

I've included some code below where I define the combobox column in the grid constructor:

{
    dataIndex:"authors_name",
    id:"authors_name",
    header:"Authors",
    editable:true,
    sortable:true,
    editor:{
        xtype:"combo",
        allowBlank:false,
        editable:false,
        forceSelection: true,
        displayField: 'authors_name',
        valueField: 'authors_id',
        store:new Ext.data.JsonStore({
            proxy:new Ext.data.HttpProxy({
                //This is the JSON request we want to cache
                url: 'index.php?load=authors'
            }),
            root: 'items',
            fields: ['authors_name','authors_id']
        })
    }
}

Answer №1

After seeking advice on the online forum, I managed to find the solution which I am sharing below:

{
    dataIndex:"authors_name",
    id:"authors_name",
    header:"Authors",
    editable:true,
    sortable:true,
    editor:{
        xtype:"combo",
        allowBlank:false,
        editable:false,
        forceSelection: true,
        displayField: 'authors_name',
        valueField: 'authors_id',
        //Include mode and triggerAction properties for local functionality
        mode:"local",
        triggerAction:"all",
        store:new Ext.data.JsonStore({
            proxy:new Ext.data.HttpProxy({
                url: 'index.php?load=categories&request=data&type=getAuthors'
            }),
            //Utilize autoload property for a single request
            autoLoad:true,
            root: 'items',
            fields: ['authors_name','authors_id']
        })
    }
}

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

The Issue of SilverStripe Custom Email Form: jQuery.ajax Failing to Pass Variables to Server

Currently, I am in the process of developing a customized email form for a SilverStripe website. This project involves a combination of jQuery, HTML, PHP, and SilverStripe API. However, I have hit a roadblock when it comes to transferring form data from th ...

"Performing a series of getJSON requests with a delay between each call, iterating through an array

Could someone shed light on why my jQuery/JavaScript code runs with an unexpected flurry of ajax calls instead of at a steady 1-per-second rhythm? var i = 0, l = data.length; function geocode() { $.getJSON( 'https://maps.googleapis.com/maps/api ...

The array is not being updated with the new value entered in the input field for "address"

Currently, I have a table that loops through an array and displays the content in a list format. The address field is displayed as an input with the value set to :value="location.address". The input fields are initially disabled, but when the ed ...

RegEx for constraining string length

I am attempting to identify all instances where the length of a string is more than 1. This is the regex I am using: string.match(/\B\w+(?=\w)/gi); I also attempted this approach: string.match(/^\B\w+(?=\w){2,}$/gi); Unfor ...

determining the position of the substring located within an "if any" function

I have two lists A and B. My goal is to extract a string from list A, find a matching string in list B, and then determine the index of that matching string in list B. I've attempted several nested loops without success. I haven't come across an ...

Learn the process of transmitting information to Thingsboard using HTTP protocol

Currently, I have thingsboard installed on my Windows local machine, and I am looking to send data from a CSV file using an HTTP POST request. In order to achieve this, I am required to develop a JAVA program that can facilitate the sending of data from ...

Switch between selection modes in React JS DataGrid using Material UI with the click of a button

I've been working on creating a datagrid that includes a switch button to toggle between simple and multiple selection modes. const dispatch = useDispatch(); const { selectedTransaction } = useSelector(...) const [enableMultipleSelection, setEnableMu ...

What is the best way to create a visual separation between these two arrows using styled-components?

Currently, I am immersing myself in styled-components and attempting to replicate the image provided below. Although I can achieve this with CSS, I am solely focusing on utilizing styled components for this task. <Container> {sliderItems.map((item) ...

Are there any alternative methods to refresh the Google Search Result for my website? (Meta tags are ineffective)

I'm facing an issue with the Google search result of my website where it's displaying old text instead of what I intended. I've tried using meta tags like nosnippet and description, but the problem persists. Can anyone suggest resources or ...

Using Selenium Webdriver to initiate the play function of a video by clicking on the control

Is there a way to play the video on this page by clicking the play button? I noticed a 'playpause' control in the JavaScript, but I'm unsure how to activate it. <div id="videoModal" class="reveal-modal expand open" style="display: block ...

The 'BaseResponse<IavailableParameters[]>' type does not contain the properties 'length', 'pop', etc, which are expected to be present in the 'IavailableParameters[]' type

After making a get call to my API and receiving a list of objects, I save that data to a property in my DataService for use across components. Here is the code snippet from my component that calls the service: getAvailableParameters() { this.verifi ...

How to implement self-updating partial views using Ajax in MVC3

I am experiencing a problem where I have a partial view within a div with the id 'rating'. Inside this partial view, there is an ajax link. The issue occurs when I click on the link - it updates once, but if I click it again, the div loads twice. ...

Streamline Your Selector Choices

I've been having difficulty trying to streamline certain query selectors. Here's the most simplified version I could come up with. $($(".NextYearDays td[data-index='1'], .NextYearDays td[data-index='2'] , .NextYearDays td[dat ...

Troubleshooting: Updating Bootstrap Carousel Image for Mobile Display

/*Custom Carousel Styling for Mobile Devices*/ @media (max-width: 425px){ #banner-one img{ background-image: url("/images/mobile_banner1.jpg") !important; } #banner-two img{ background-image: url("/images/mobile_banner2.jpg") !important; ...

Probability of an event occurring when represented as whole numbers in percentage form

Currently, I'm developing a unique job system within a Discord bot that allows users to mine various types of ores. The probability of receiving specific ores is based on the user's mining skill level, which is stored in a database and can vary a ...

Utilize promises within a for loop to handle asynchronous data fetching

Extracting match id and series id from the firebase database, storing them in an object "ids," then pushing the values into an array named "arr." var options3 = { method: "GET", hostname: "dev132-cricket-live-scores-v1.p.rapidapi.com", port: null, ...

Facing an "error: JSON object access not defined" issue? Read on to find

$(document).ready(function() { var output = "<div>"; $.getJSON('https://search-a.akamaihd.net/typeahead/suggest/?solrformat=true&rows=20&callback=noCB&q=*%3A*+AND+schoolid_s%3A1255&defType=edismax&qf=teacherfirstna ...

Issues with validating the Google Maps API JavaScript tag

Currently working on updating a website to be fully validated with HTML5 using W3C standards. Having trouble validating the Google Maps API JavaScript tag in the code snippet below: <script src="http://maps.googleapis.com/maps/api/js?libraries=places& ...

"Vue allows developers to define components by providing both template and script through the Vue()

I'm currently facing an issue while setting up a component within my global Vue() initialization. Surprisingly, I've managed to define the template for the component, but I'm struggling to specify the actual class that is executing the opera ...

Transferring data from controller to repository in Laravel: a step-by-step guide

Looking for some assistance here! I need to pass an ID to my repository but keep getting the error message illegal offstring id. Any help is appreciated! Here's my controller: public function delete() { $response = ['status' => false ...