- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我创建了一个 Ext.TreePanel 并且我会在节点中有一个图像,在节点的文本中我有图像的 url 但我无法在页面中加载它,我只看到文本,那里是否可以查看图像?
这是我的代码
var root1 = new Tree.AsyncTreeNode({
text: 'Legenda degli starti PAT',
draggable:true, // disable root node dragging
id:'source'
});
var tree1 = new Tree.TreePanel({
renderTo : 'legend',
animate:true,
loader: new Tree.TreeLoader({dataUrl:'legend.php'}),
containerScroll: true,
root: root1,
});
这是 TreePanel 请求的响应
[{"text":"comuni","id":"co","leaf":false,"cls":"folder","children":[{"text":"http:\/\/localhost\
/cgi-bin\/mapserv?map=\/home\/gis\/mapserver\/cartocomune_wms.map&SERVICE=wms&FORMAT=png&VERSION=1.1
.1&LAYER=comuni&REQUEST=GetLegendGraphic","id":"comuni","leaf":true,"cls":"file"}]},{"text":"idrografia"
,"id":"id","leaf":false,"cls":"folder","children":[{"text":"http:\/\/localhost\/cgi-bin\/mapserv
?map=\/home\/gis\/mapserver\/cartocomune_wms.map&SERVICE=wms&FORMAT=png&VERSION=1.1.1&LAYER=idrografia
&REQUEST=GetLegendGraphic","id":"idrografia","leaf":true,"cls":"file"}]},{"text":"viabilita","id":"via"
,"leaf":false,"cls":"folder","children":[{"text":"http:\/\/localhost\/cgi-bin\/mapserv?map=\/home
\/gis\/mapserver\/cartocomune_wms.map&SERVICE=wms&FORMAT=png&VERSION=1.1.1&LAYER=viabilita&REQUEST=GetLegendGraphic"
,"id":"viabilita","leaf":true,"cls":"file"}]},{"text":"uso_suolo","id":"uso","leaf":false,"cls":"folder"
,"children":[{"text":"http:\/\/localhost\/cgi-bin\/mapserv?map=\/home\/gis\/mapserver\/cartocomune_wms
.map&SERVICE=wms&FORMAT=png&VERSION=1.1.1&LAYER=uso_suolo&REQUEST=GetLegendGraphic","id":"uso_suolo"
,"leaf":true,"cls":"file"}]},{"text":"catasto","id":"cat","leaf":false,"cls":"folder","children":[{"text"
:"http:\/\/localhost\/cgi-bin\/mapserv?map=\/home\/gis\/mapserver\/cartocomune_wms.map&SERVICE=wms
&FORMAT=png&VERSION=1.1.1&LAYER=catasto&REQUEST=GetLegendGraphic","id":"catasto","leaf":true,"cls":"file"
}]}]
谢谢卢卡
最佳答案
您需要在 JSON 中为节点包含一个“iconCls”属性,该属性引用一个 CSS 类,该类定义了您希望为该特定节点显示的图像。
根据 extjs.com 上的 API 文档:
//在类的配置中指定属性: ... iconCls: '我的图标'
//指定要用作图标图像的背景图像的 css 类:.my-icon { background-image: url(../images/my-icon.gif) 0 6px no-repeat !important;
因此您的 JSON 将如下所示:
[{"text":"comuni","id":"co","leaf":false,"cls":"folder","children":[{"text":"http://本地主机\/cgi-bin/mapserv?map=/home/gis/mapserver/cartocomune_wms.map&SERVICE=wms&FORMAT=png&VERSION=1.1.1&LAYER=comuni&REQUEST=GetLegendGraphic","id":"comuni","leaf":true,"cls":"file", "iconCls": "my-icon"}]}, {“文本”:“idrografia”,"id":"id","leaf":false,"cls":"folder", "iconCls": "my-icon"} ...等等...等等... }]
关于javascript - extjs 在 TreePanel 中加载图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1118958/
我想使用拖放操作将一棵树的根节点添加到另一棵树中。我用于此任务的示例位于以下 URL 中: http://gwt-ext.com/demo/#twoTrees 请尽快帮助我。 最佳答案 在同一个链接中
我正在使用 ExtJS 2.2.1 在我的网络应用程序中,我曾经有一个只有一个根的 TreePanel,如下所示: ` |- Colors |- Blue |- Red |- Yel
我做了一个Fiddle重现我的问题的测试用例:选择事件被触发两次。即使是 selectionchange 也是如此。但是 cellclick 只触发一次。我使用 ExtJS5.1.1 GPL。 注意:
如何使用 Ext.tree.ViewDDPlugin 的事件? 我有一个使用 DDPplugin 的 TreePanel,但我想知道如何监听 drop 事件。 这是我的代码的样子: var monPr
如何在 extjs 中刷新 TreePanel 的内容并保存节点状态(展开/折叠)。当我做的时候 fileList.root.reload(); 所有展开的节点都折叠起来。我怎样才能避免这种情况? 谢
我加载了一个项目展开的 TreePanel(在我的 json 中定义)但是当它显示时它没有展开。 只是打开了目录(图标),但没有显示项目。我加载它使用加载存储功能重新加载我的树面板。 storeTre
ExtJS 4: 我创建了一个树面板。我想为其节点设置自己的图标,因此我为每个节点使用了 iconCls 属性。它的工作。但是当我展开一个节点时,它会返回到其正常的“打开文件夹”图标。 var tre
我有一个树面板。当我过滤 TreePanel 的存储以使节点显示为空时,打开该节点的符号仍然存在。我认为如果文件夹内容不可见,打开文件夹的符号消失会更好。有解决办法吗? https://fiddle.
像这样的树状结构 var rootNode = { id: 'root', text : 'Root Node', expanded :
我用 TreeStore & TreePanel .我需要在我的 Tree 中插入新节点,如何做到这一点? 我有 TreeStore遵循配置的组件: var monPrestore = Ext.cre
当用户单击按钮时,我试图检索 TreePanel 的选定节点(如果有)。如何检索 TreePanel 中的选择节点?谢谢。 最佳答案 您要做的是创建一个事件处理程序。每个 ExtJs 对象都有许多与它
我遇到一个问题,在使用内联存储定义 TreePanel 时看不到树节点的文本。但是,如果我外部化存储定义并将其移动到一个单独的变量,然后将其分配给 TreePanel(如 API 文档中所示),则它工
我想创建一个 Treepanel,它每秒更新一次。所以我拿了一个有代理的商店来获取数据: store = new Ext.data.TreeStore({ model: 'TaskState'
我创建了这个简单的树: var children = [{ text:'My Layers', children:[ new Ext.tree
如何修改该示例 http://www.extjs.com/deploy/dev/examples/tree/reorder.html 需要 RESTful 支持? 当我们点击某个节点时,它发送 POS
如何使用本地 JSON 对象将一些任意数据加载到树面板中? ExtJS 4.0 发行版附带的所有示例都适用于 AJAX 请求。 最佳答案 有一个使用 MemoryProxy 的例子在 Sencha 文
我创建了一个 Ext.TreePanel 并且我会在节点中有一个图像,在节点的文本中我有图像的 url 但我无法在页面中加载它,我只看到文本,那里是否可以查看图像? 这是我的代码 var root1
我一直试图让我的树面板以两种方式滚动。这是我的代码:https://fiddle.sencha.com/#fiddle/13cb 我可以在包装面板中设置scrollable: true,但这并不能解决
我有一个 Ext.tree.Panel,它有一个 TreeStore。这棵树在一个选项卡中。问题是,当我的应用程序加载应用程序中使用的所有树时,即使存储在 autoLoad: false 上,也会加载
我想创建 Ext.tree.TreePanel 组件并定期从外部 URl 加载内容。所以我写了类似的东西 new Ext.tree.TreePanel({ root: {
我是一名优秀的程序员,十分优秀!