creating a fresh window using AJAX in Ext JS

While I know there may be similar questions out there, the details of my situation are unique. I'm facing an issue with building a new window using ExtJS, starting from a pre-existing grid. The goal is to populate this new window with references to elements selected in the previous grid.

Here's what I've tried: I included an ajax call within the first grid and created a column containing an image that users can click to access the second grid. However, when clicking on the image, nothing happens. Have I made a mistake with the ajax call? Or perhaps with passing JSON data to the page for the grid's store in the new window?

 var grid = Ext.create('Ext.grid.Panel', {
    // Grid configurations here
}); 

Answer №1

When running the code below, a new window will open and retrieve data for an ajax call. However, the "store" functionality is not functioning properly, so I will create a separate question to address this issue.

{
            xtype : 'actioncolumn',
            width : '5%',
            sortable : false,
            items : [{
                icon : '../static/accept.gif',
                tooltip : 'See Admants',
                handler : function(grid, rowIndex, colIndex){
                    var row = grid.getStore().getAt(rowIndex);
                     var buyer_member_id = row.data.buyer_member_id;
                    Ext.Ajax.defaultHeaders = {
                        "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
                    };
                    Ext.Ajax.request({
                        method : "GET",     
                        url: '/admants/?buyer_member_id='+ buyer_member_id,
                        success : function(response) {
                            var obj = response;
                            try {
                                obj = Ext.decode(response.responseText);
                            } catch (error) {}
                            if (obj) {
                                Ext.create('Ext.window.Window', {
                                title: 'Hello',
                                height: 200,
                                width: 400,
                                layout: 'fit',
                                items: {  
                                xtype: 'grid',
                                border: false,
                                columns: [
                                        {
                                            text     : 'id',
                                            flex     : 1,
                                            sortable : true,
                                            dataIndex: 'id'
                                        },
                                        {
                                            text     : 'name',
                                            width    : 300,
                                            sortable : true,
                                            dataIndex: 'name'
                                        }],
                                store: new Ext.data.JsonStore({
                                    storeId: 'myStore',
                                    proxy: {
                                        type: 'ajax',
                                        url: '/admants/',
                                        reader: {
                                            type: 'json',
                                        }
                                    },})

                                }}).show();
                            } else {
                            alert("Invalid response")
                            }
                        },
                        failure : function(response) {
                            alert("Data request failed");
                        }
                    }); 
                }
            }]
        }
    ],

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

Obtain data using a jQuery AJAX request

Below is the original code snippet: var result = null; $.post('test.php', 'q=testdata', function(response) { result = response; }); I have a requirement to utilize result in my code, either during or immediately after the ajax requ ...

Display a dropdown menu when hovering over with a delay

I recently created a basic navigation menu with dropdown functionality using CSS3 initially, but I decided to enhance it by incorporating jQuery to display the dropdown after a set timeframe. However, I am facing an issue where all dropdowns appear when ho ...

What is the best way to activate an event listener only after a button has been clicked?

Currently, I am developing a game that includes a timer and an event listener that notifies the user not to switch tabs. However, I am facing an issue where the event listener triggers before the game's start button is clicked. Is there a way in JavaS ...

Ways to display output on a single line using javascript

It seems like such a simple task, but no matter how I try, I cannot get proper spacing between my words. /s does not seem to work for me. Here is an example of what I have attempted: document.write('You have been alive' + */s userMsDays /s* + &ap ...

Should one prioritize learning TypeScript over diving into Angular2?

Should I prioritize learning TypeScript before diving into AngularJS 2? ...

Transfer files using Ajax and FormData technique

I have extensively researched various topics on this issue and prefer not to rely on any external plugins. function addToDatabase(menuItem){ var formData = new FormData(); formData.append("Description", document.getElementById("DescriptionID").value); ...

Three.js Pin Placement for Clothing

I am in need of assistance! I am currently working on a simulation involving a cloth that is attached to four corners. I am attempting to reposition the pins at coordinates 0, 10, 88, 98 within a 10x10 array. My goal is to place each pin at a different pos ...

NodeJS and DiscordJS: The art of modifying JSON files

Currently, I am grappling with the concept of appending data to a JSON file. The specific file in question (users.json) has the following structure: { "users": { "id": "0123456789", "name": "GeirAnders ...

Why is the model so tiny after converting my FBX file to a .gltf format?

QUERY: I am facing an issue where my model appears extremely small after converting the FBX file to a .gltf format. Despite attempting to scale the model using frontObject.scale.set(1000, 1000, 1000);, I encounter the following error: TypeError: Cannot r ...

In JavaScript, a "switch statement" retrieves a test value from a "input type text" by accessing the value using getElementByName.value

Attempting to test 7 possible values for the variable 'a' by passing it to a function from user input in seven 'input type text' boxes, then checking each value individually with clicks on 7 'input type image' elements. Howeve ...

The play button on the iOS video player will be deactivated automatically after watching 15 videos

I have developed an application using the Ionic Framework that includes multiple videos for playback. To organize these videos, I created a category system where users can click on a video title to access the corresponding video player page. The video pla ...

Avoid having the last action repeat when the page is refreshed

I'm currently working with asp.net web forms update panel, and I've encountered an issue where the last request is repeated whenever I refresh a page. This causes an unintended effect where if I delete a record and then refresh the page, another ...

Issue with h2 tag within JQuery's read more feature

How can I modify my jQuery code to wrap the middle text in an h2 tag? I am currently using a code snippet from code-tricks. You can find the original code snippets here: $(document).ready(function() { var showChar = 100; var ellipsestext = "..."; ...

Error encountered when executing the npm run dev script

Attempting to follow a tutorial, I keep encountering an error related to the script. I've tried restarting the tutorial to ensure I didn't overlook anything, but the same issue persists. Working on a Mac using pycharm. In the tutorial (from Ude ...

Error message: "PHP encounters an issue with jQuery due to absence of 'Access-Control-Allow-Origin' header"

I am currently attempting to make an external API call in PHP using AJAX and jQuery, but I keep encountering the error message saying "No 'Access-Control-Allow-Origin' header is present". The API does not support JSONP. Is there any workaround t ...

How can parameters be included in ng-href when using ng-click?

So I have this list of products and I want to pass the current product id when clicking on ng-href by using a function with ng-click in the ng-href. This is what my html file looks like: <div class="agile_top_brands_grids" ng-model="products" ng-repe ...

Inquirer doesn't waste time lingering for user input following a prompt

After initiating the prompt, I'm encountering an issue where inquirer doesn't pause for user input and instead immediately advances to the next command line. Below is the code I'm using: import inquirer from 'inquirer'; var link; ...

Exploring the Implementation of Conditional Logic Using Variables in ReactJS

I have a current project in Reactjs where I am extracting the current url/hostname. My goal is to utilize this URL within an if-else statement - meaning, if the url="/" (home page) then display the first header, otherwise display the second hea ...

Can the App be initiated manually using AngularJS and AJAX injection?

My current Angular application is loaded dynamically into the existing webpage. This means that all scripts (such as angular.min.js and controllers) are included in the Wicket AJAX request and injected into the webpage. The scripts are added to the head o ...

Obtain Page Parameters within a Nested Next.js Layout using App Router

My Next.js App Router has a nested dynamic page structure using catchall routes configured like this: app/stay/ |__[...category] | |__page.js |__[uid] | |__page.js |__layout.js Within the 'layout.js' file, there is a con ...