Solution to extjs grid getting data without displaying it_extjs
After searching for almost an hour, I just don't know where the error is. . . Depressed
I clicked on the tree node on the left side of the mouse and created a tab on the right. This was already possible, so I nested a Grid in the newly created tab.
A strange problem occurred. .
No error is reported in FF and IE. But the Grid just doesn't display. Originally I thought my code was wrong. So I frantically searched for problems with my code and accidentally turned off FF's firbug plug-in interface, and the grid came into reality. . . It turns out that the Grid will only be displayed as long as there are any changes to my window.
Is this a problem with my code or a bug? How to solve it?
To add, I have no problem using items to manage grid objects directly in TabPanel. But something went wrong after I added the event and managed it.
Files are all encapsulated in class packages. So only the key part is posted
This is the listening event.
Java code
listeners:{
'click':function(node, event) {
event.stopEvent();
//Remove the selection judgment of the root node
if (node.text=="SamPeng" || node.text == "Article Management" || node.text == "Product Management" || node.text == "Information Management" || node.text == " Visitor management"){
}else{
var n = main.getComponent(node.id);
if (!n) { //Determine whether the panel has been opened
//If so Click the article list, create a new list object and throw it into the new tab
if(node.text == "Article List"){
var grid=new SamPeng.account.list();
n = main.add({
'id':node.id,
'title':node.text,
items: [{layout:"fit",items:grid}]
});}
}
main.setActiveTab(n);
}
}
listeners:{
'click':function(node, event) {
.stopEvent();
Management" || node.text == "Information Management" || node.text == "Visit Management"){
if (! n) {// Determine whether the panel has been opened
// If it is a list of articles, create a new list object and throw into the new tab
if (node.text == "article list list "){
var grid=new SamPeng.account.list(); 'id':node.id,
'title':node.text,
Then my tab panel creation class
Java code
* Copyright(c) 2008-2010, SamPeng Inc.
*/
package("SamPeng.panel");
/**
* Function: Used to create the main display panel in the middle
* Author: SamPeng
* Time: September 24, 2008 1:24:42
*/
SamPeng.panel.main = function(config){
var config=config || {};
var deconfig={
renderTo:'mainlay' ,
width:1000,
height:561,
activeTab:0,
plain: true,
border: true,
tabPosition: 'top',
frame: true,
autoScroll: true,
enableTabScroll:true, //If the width exceeds the width, additional scroll bars will automatically appear on both sides
items:[{
title:"Homepage"
}
]
}
Ext.applyIf(config,deconfig);
SamPeng.panel.main.superclass.constructor.call(this,config);
}
Ext.extend(SamPeng.panel .main,Ext.TabPanel);
* Copyright(c) 2008-2010, SamPeng Inc.
*/
package("SamPeng.panel");
/**
* Function: Used to create the main display panel in the middle
* Author: SamPeng
* Time: September 24, 2008 1:24:42
* /
SamPeng.panel.main = function(config){
var config=config || {};
var deconfig={
renderTo:'mainlay',
width :1000,
height:561,
activeTab:0,
plain: true,
border: true,
tabPosition: 'top',
frame: true,
autoScroll: true,
enableTabScroll:true,//If the width is exceeded, additional scroll bars will automatically appear on both sides
items:[{
title: "Home" 🎜> 🎜> Ext.applyIf(config,deconfig);
SamPeng.panel.main.superclass.constructor.call(this,config);
}
Ext.extend(SamPeng.panel.main,Ext. TabPanel);
Grid only pastes data sources and attributes.
Java code
/***************************************************** ***
* Create a data source for the table
* Link to the background and return the data list of each page
* Pass it in Json data format
********** **********************************************/
this.dataStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: ' php/article_list.php',
disableCaching:false
}),
reader: new Ext.data.JsonReader({
root: 'results',
totalProperty: 'total',
id:'id'
},[
{name: 'id'},
{name: 'name'},
{name: 'typename'},
{name: 'time'},
])
});
this.dataStore.load({params:{start:0, limit:this.myPageSize}});
. . .
. . . Omit a lot of
. . .
/***************************************************** ***
* Construct the edit list panel (GridPanel)
********************************** **********************/
SamPeng.account.list.superclass.constructor.call(this, {
id: 'list-account-panel',
ds: this.dataStore ,
cm: art_cm,
sm: selectBoxModel,
height:500,
tbar: pagingbar,
bbar: menubar,
loadMask: {msg: 'Reading data. ..'},
enableColumnHide: false,
autoScroll:true
//region:'center'
});
Ext.extend(SamPeng.account.list, Ext.grid .GridPanel, {
reload : function() {
this.dataStore.load({params:{start:0, limit:this.myPageSize}});
},
// call Delete data
//The server returns deleted data by accepting parameters
deleteData: function (jsonData) {
this.dataStore.load({params:{start:0, limit:this.myPageSize, delData: jsonData}});
}
/***************************************************** ***
* Establish a data source for the table
**********************************************/
this.dataStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy( {
url: 'php/article_list.php',
disableCaching:false
}),
reader: new Ext.data.JsonReader({
Root: 'results' ,
totalProperty: 'total',
id:'id'
},[
{name: 'name'},
{ name: 'typename'},
{name: 'time'},
. myPageSize}});
. . .
. . . Omit a lot of
. . .
/***************************************************** ***
* Construct the edit list panel (GridPanel)
********************************* **********************/
SamPeng.account.list.superclass.constructor.call(this, {
id: 'list-account-panel',
ds: this.dataStore,
cm: art_cm,
sm: selectBoxModel,
height:500,
tbar: pagingbar,
bbar: menubar,
loadMask: {msg: '读取数据中 ...'},
enableColumnHide: false,
autoScroll:true
//region:'center'
});
Ext.extend(SamPeng.account.list, Ext.grid.GridPanel, {
reload : function() {
this.dataStore.load({params:{start:0, limit:this.myPageSize}});
},
// 调用删除数据
// 服务器通过接受参数返回删除的数据
deleteData : function (jsonData) {
this.dataStore.load({params:{start:0, limit:this.myPageSize, delData:jsonData}});
}
谢谢各位大侠了!
问题状况是我浏览器不动,Grid死活不显示,浏览器一变,Grid就出来了。而且是按照我设定的参数大小显示的。不明白倒底问题出在哪里。只有这么多分了。望指教
本来以为是代码有问题,看Firebug没有报错,并且观察Firebug确实从服务端取得了数据。搞了很久没有想出问题,但是什么也不干,把窗口最小化再最大化的时候,数据又出来了!!!
这可能是Extjs的一个Bug,从网上找类似的解决方法,找到了这个:
,后来又和qiuye402大侠进行了沟通终于搞定。
其实就是布局刷新的问题,只需将最外层的容器重新render一下就可以了。最外层的容器一般就是类似于viewport的东东了,刚开始不知道,一直重新render包含grid的panel,没有效果,重新render viewport一切OK了!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

In front-end interviews, we are often asked how to implement dice/mahjong layout using CSS. The following article will introduce to you how to use CSS to create a 3D dice (Flex and Grid layout implement 3D dice). I hope it will be helpful to you!

When we view pictures, we only need to roughly see the thumbnail of each picture in the folder, so that we can quickly browse or find the pictures we need. However, sometimes image thumbnails are not displayed. It may be due to settings or insufficient memory. The specific solutions are as follows. Win7 picture thumbnails are not displayed. Solution Method 1: 1. First, select "Organize" in the upper left corner of the folder, and then click "Folder and Search Options". 2. Uncheck "Always show icons, never thumbnails" and click OK. Method 2: 1. First check whether your C drive still has enough space, at least 1GB or more. 2. If not, right-click the C drive and select Properties, then click "Disk Cleanup" in "General". 3.

Many students often fail to pop up the USB flash drive normally when using it. Instead, they unplug it directly, causing the drive letter not to be displayed. The following will teach friends how to solve it: Step 1: Select the win icon in the lower left corner of the desktop and select the number one from the bottom. Two setting options. Step 2: Select device options. Step 3: Find other devices and find the USB flash drive icon. If you don’t recognize it, don’t panic. Just stay on this interface and you can find it by plugging in the USB flash drive. Step 4: Remove the device from the stand-alone USB flash drive icon, and plug the USB flash drive again and the drive letter will be displayed. If it helped you, please like it and encourage me to solve more computer problems for you. This is an article updated by the trial version of Shuimiao·dedeCMS station group article updater, so it has this mark (2023-02-0617:27:18)

CSS layout framework: Explore the five commonly used layout frameworks Introduction: In web design, layout is a crucial part. The CSS layout framework can help us quickly build web pages with different layout styles. This article will introduce five commonly used CSS layout frameworks and provide specific code examples to help readers better understand and use these frameworks. 1. Bootstrap: Bootstrap is one of the most popular CSS layout frameworks currently. It has rich components and powerful responsive features that can

With the continuous development and popularity of Web applications, more and more companies and individuals are beginning to use PHP and ExtJS to build powerful Web applications. As a popular server-side scripting language, PHP is cross-platform and easy to learn, while ExtJS is a popular front-end framework that can help developers quickly build interactive web application interfaces. This article will introduce how to use PHP and ExtJS to implement powerful web application functions. Establish PHP and MySQL database connections for use

All useless files and garbage on the computer are stored in the recycle bin. Many users find that their recycle bin is gone after updating the win11 system, resulting in the inability to restore the required files. For this reason, we will bring it to you today. Come and find out how to solve the problem of Win11 not displaying the Recycle Bin. What to do if the Recycle Bin is not displayed in Windows 11? 1. First, right-click the mouse on a blank area of the desktop and select the "Personalize" option in the pop-up menu. 2. After selection, a settings interface will appear. Find the theme option on the left side of the settings interface and click it. 3. After clicking, scroll down on the right side to find and click the "Desktop Icon Settings" option. 4. After clicking, you can see the recycle bin selection interface. 5. Check the Recycle Bin and click OK to restart

CSS adaptive layout attribute optimization tips: flex and grid In modern web development, implementing adaptive layout is a very important task. With the popularity of mobile devices and the diversification of screen sizes, it is an essential requirement to ensure that the website can be displayed well on various devices and adapt to different screen sizes. Fortunately, CSS provides some powerful properties and techniques for implementing adaptive layout. This article will focus on two commonly used properties: flex and grid, and provide specific code examples.

Detailed explanation of CSS relative layout properties: position and relative In front-end development, layout is often a problem that developers need to face. In order to better control the position of elements on the page, CSS provides a variety of layout methods. Among them, relative layout is a very common layout method. By using the position and relative attributes, we can flexibly adjust the position and size of elements. The position attribute is used to define the positioning method of the element. Common values
