我是extjs的新手,所以需要帮助.
我在我的数据库中上传了图片,
sb.append(System.getProperty("java.io.tmpdir"))
.append(System.getProperty("file.separator"))
.append("temp.jpg");
FileOutputStream fos = new FileOutputStream(sb.toString());
fos.write(myFileService.getImage.getBytes()); // it works ok
fos.close();
FileBean fb = new FileBean();
fb.setName("temp.jpg");
fb.setUrl(sb.toString());
res.put("image", fb);
我的面板在示例中看起来像..
var imgPanel = new Ext.Panel({
padding: 5,
margins: '0 0 5 5',
id:'images-view',
frame:true,
collapsible:false,
layout:'fit',
items: new Ext.DataView({
store: imgStore,
tpl: tpl,
height:200,
width: 200,
multiSelect: false,
overClass:'x-view-over',
itemSelector:'div.thumb-wrap',
emptyText: 'No images to display',
plugins: [
new Ext.DataView.DragSelector({dragSafe:true})
],
这是商店
imgStore = new Ext.data.JsonStore({
url: '/foo',
root: 'image',
fields: [
'name', 'url'
]
});
我得到了很好的响应,但面板显示emptyText值,重新加载存储后.可能是我得到了不正确的网址?如果是的话,如何让它发挥作用?我需要将我的图片保存在临时文件中,然后显示它.我认为我的问题出在服务器端.如何在我需要的网址上保存它,然后通过这个网址获取它?帮帮我吧….
解决方法:
请点击此链接,这可以帮助您:
http://docs.sencha.com/extjs/6.0/6.0.1-classic/#!/api/Ext.Img
您可以使用默认图像xtype在Extjs中显示图像
var changingImage = Ext.create('Ext.Img', {
src: 'http://www.sencha.com/img/20110215-feat-html5.png',
width: 184,
height: 90,
renderTo: Ext.getBody()
});
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。