ExtJS json存储没有填充 [英] ExtJS json store not populating

查看:98
本文介绍了ExtJS json存储没有填充的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近通过继承3.4中编写的网络应用程序潜入ExtJS。我设法创建一个连接到网格的商店,没有任何问题,并且已经能够使用从调用php页面加载的数据来启动一个PanelForm。



我有另一个json存储,当我调用它的加载过程时,它不会被填充,我想知道我在丢失什么。



存储的定义如下:

  var ImgStore = new Ext.data.JsonStore({
totalProperty:'total'
, root:'data'
,url:'json / getProductImage /'
,fields:[{
name:'img'
},{
name: extn'
}]
});

加载数据的代码是:

  ImgStore.load({callback:function(){} 
,params:{'ProductGUID':x}
});

URL后面的代码是正确的,在Firebug中的响应如下:

  {success:true,data:{img:iVBORw0KG ... ggg ==,extn:png }} 

我不明白的是为什么回应回来,但商店没有填充。我一定要错过一些东西我只是看不到什么...



商店是否必须绑定到另一个对象?我想做的是读回base64编码的字符串,然后在屏幕上显示图像(面板上的FormPanel或Container;真的不确定最好的方法)


$ b $

解决方案

一切看起来都很好,除了url配置不是你错过了文件的名称? JSON / getProductImage / myfile.json



如何验证存储是否通过将其绑定到网格来加载?因为如果是这样,store可能正在加载但没有正确配置网格可能会让你认为商店没有加载,尝试 console.log(store.getTotalCount())


I've recently taken a dive into ExtJS by inheriting a web app written in 3.4. I've managed to create a store attached to a grid with no problem and have been able to bring up a PanelForm with data loaded from a call to a php page.

I have another json store defined which doesn't get populated when I call its load procedure and I'm wondering what I am missing.

The definition of the store is below:

var ImgStore = new Ext.data.JsonStore({
 totalProperty: 'total'
,root: 'data'
,url : 'json/getProductImage/'        
,fields : [{
    name : 'img'
},{
    name : 'extn'
}]
});

My code to load the data is:

ImgStore.load({callback: function() {}            
        ,params: {'ProductGUID': x}
    });

The code behind the URL is fine and the response in Firebug below:

{"success":true,"data":{"img":"iVBORw0KG...ggg==","extn":"png"}}

What I cannot understand is why the response comes back but the Store does not populate. I must be missing something; I just can't see what...

Does the Store have to be bound to another object? What I wanted to do was to read back the base64 encoded string and then show the image on screen (on either a panel, FormPanel or Container; not really sure of the best method really)

Any advice is greatly received.

解决方案

Everything looks fine, except for the url config aren't u missing the name of the file ? 'json/getProductImage/myfile.json'?

How are you validating store is not loaded by binding it to a grid? Because if so, store could be loading but not configuring grid properly might make u think store is not loaded, try console.log(store.getTotalCount())

这篇关于ExtJS json存储没有填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆