Json with ExtJs columns data is fully populated

I am having trouble with displaying columns in my jsp which fetches json data. I am retrieving this json data in my javascript and using Ext.data.JsonStore but the columns are not showing up as expected.

Here is the code for the store:

store = new Ext.data.JsonStore({
url: url_servlet+'Kadastr.jsp',
    fields: [
        {name: 'indoor', type: 'bool'},
        {name: 'kad_id', type: 'integer'},
        {name: 'kad_name',type: 'string'}
    ]
});
store.load();

And here is the code for the columns:

var cm = new Ext.grid.ColumnModel({
    columns: [{
        xtype: 'checkcolumn',
        header: '',
        dataIndex: 'indoor',
        width: 50
    }, {
        header: 'id',
        dataIndex: 'kad_id',
        width: 70
    },{
        id: 'kad_name',
        header: 'Участок',
        dataIndex: 'common',
        width: 130,
        }]
})

Next, we have the grid panel:

var kad_tab = new Ext.grid.GridPanel({
    store: store,
    cm: cm,
    id: 'kad_greed',
    title:'Список Участков',
    autoScroll: true,

Finally, here is some java code snippet:

            JSONObject resultJson = new JSONObject();
    resultJson.put("indoor",new Boolean(false));
    resultJson.put("kad_name",fileName);
    resultJson.put("kad_id",new Integer(fileId));
            out.println(resultJson.toString());

Do you have any ideas on what might be missing or incorrect in the setup?

Answer №1

The shop scanner is designed to read an array of items, however it seems you are only sending a single record. Instead of:

{"indoor":false,"kad_name":"filename"..}
, you should send an array with a root object. Here's an example:

{"values":[{"indoor":false,"kad_name":"filename"..}]}
and then simply add the root "values" to the jsonreader. The default root is "", so you can leave it blank by default.

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 a workaround for sending a large/multi-part JSON object without adjusting the maxJsonLength setting?

I'm facing an issue in my C# web application where I receive a JSON object from a WebMethod and it exceeds the maximumJSONLength, resulting in: InvalidOperationException: The length of the string exceeds the value set on the maxJsonLength property. ...

Tips for activating the default 500 error page in Next.js

I'm having trouble getting Next.js to display its default 500 error page. While most sources discuss creating a custom error page, the Next.js documentation only briefly references their built-in 500 error page. I want the default page to show up when ...

Switch between pages within a reactjs application by utilizing react router

Greetings! I am currently diving into the world of reactjs and experimenting with navigation from one page to another by simply clicking on a link through react router. In my home.js file, I have listed out some interesting places and I aim to click on one ...

transferring data to Amazon Web Services using Angular framework

I'm currently facing an issue while trying to send a file to an AWS server using an Angular dropzone. I have my AWS credentials ready, but I am unsure of how to properly make the request. Every time I attempt to drop the file into the dropzone, I kee ...

Is it possible to reload the webpage just one time after the form is submitted?

Can anyone suggest how I can refresh the webpage using PHP after submitting a form? I've been searching for a solution but haven't found one yet. Your assistance would be greatly appreciated. ...

Guide to building a nested React component

My custom dropdown component requires 2 props: trigger (to activate the dropdown) list (content to display in the dropdown) Below is the implementation of my component: import { useLayer } from "react-laag"; import { ReactElement, useState } fr ...

Steps to add npm peerDependencies for a warning-free installation

Stackoverflow has plenty of questions about npm peerDependencies warnings, but none specifically address the best practices for actually handling the dependencies. Should we save them along with our dependencies and devDependencies? If so, what is the purp ...

View the JSON obtained through AJAX requests

Take a look at the following code snippet: <script type="text/javascript" src="Javascript/json2.js"></script> <script type="text/javascript" src="Javascript/jquery-1.11.1.min.js"></script> <script type = "text/javascrip ...

Can you combine multiple items in PaperJS to move them collectively?

I'm working on a PaperJS project that involves numerous circles that can move independently. In addition to this, I would like each circle to have PointText at its center acting as a label. However, instead of having to manually animate each label ev ...

Communicate with a PHP page using Volley for both sending and receiving data

I am planning to pass a parameter to a PHP page, and after performing specific processing on it, I want to receive a series of parameters in JSON format from the same page. Below is the code I have written for this: //Displaying progress dialog final Prog ...

Ways to retrieve and update the state of a reactjs component

I'm facing an issue with modifying a React JS component attribute using an event handler. export default interface WordInputProps { onWordChange:(word:string) => void firstLetter:string disabled?:boolean } These are the props for my co ...

Validator for Node using Json format

I have some inquiries related to server operations. There are over 50 APIs that I need to review. For each API (GET,POST) method, the following criteria must be checked: Validation of input as valid JSON format Verification of key names in the input da ...

Steps for referencing an autogenerated id in a Firestore collection

I need assistance updating a 'progress' field in a document with an autogenerated ID (using Firestore) every time the progress button is clicked. https://i.stack.imgur.com/hZieN.png Despite my attempts, nothing seems to work. Here is the method ...

Tips on how to obtain the element reference while using v-if in Vue

I need to conditionally display a div inside a card that slides within a carousel. My current approach is to check if the ancestor element contains the active class, and then use v-if to decide whether it should be rendered or not. However, this method d ...

PHP variable missing "+" sign at the end after post operation

I have encountered a unique problem that I cannot seem to find anywhere else. My issue lies in adding grades ending with a plus sign, such as B+, C+ or D+. I am able to add grades like A-, B-, C- and D- without any problem, but when it comes to adding a g ...

Automate the installation of an npm package while including the --save-dev flag

There is a lesser-known trick where npm can be utilized as a Node.js module to execute commands within the code. I am looking to gather user input on which packages are needed, install them programmatically while also saving them to the package with the - ...

Different kinds of garbage collection operations in NodeJS

When utilizing the perf_hooks module in NodeJS, we have access to information regarding garbage collection. This can be achieved by using PerformanceObserver, which is triggered with each garbage collect event. const obs = new perf_hooks.Performanc ...

Variable for Sweet Alert Input Box

I am completely new to PHP and JavaScript, so my question is fairly straightforward... I have a JavaScript code snippet (Sweetalert2 text field) and I'm looking to capture the information entered by users in a separate PHP file using AJAX. I've b ...

I found myself puzzled by the error message "Module protobufjs not found."

I am currently utilizing the node library known as node-dota2. I have completed all the necessary steps required by node-dota2, as outlined on this site: https://github.com/Arcana/node-dota2#installation-and-setup 1. Installed it using npm 2. Created a fil ...

Divide the string once it reaches the initial appearance of a character following a specified matching string

Data Breakdown: { \"value\": 17.11, \"year\": 2015, \"sub\": [ {\"x\": 0, \"y\": 0.94 }, {\"x\": 1, \"y\": 1.08 }] } , { \"value\": 17.23, \"year\": 2015 ...