I am trying to use JQuery JsTree with Python Pyramid + Chameleon. All goes well except the definition of icons.

My JSTree is loaded from a XML that I produce using Python, but when I try to set the icon with:

contentName.attrib["icon"] = "./edit.png"

It does not show the icon (not even the default icon) because such resource does not exists in my pyramid application. However if I declare a resource URL called "static" with:

config.add_static_view('static', 'static', cache_max_age=3600)

and I set the icon to:

contentName.attrib["icon"] = "${request.static_url('xmlmetaeditor:static/edit.png')}"

JSTree load the defaul icon. But not my edit.png icon

Any idea how to properly indicate the icon?

Thanks,

Carlos.

有帮助吗?

解决方案

I made it work.

Basically you declare a resource directory with:

config.add_static_view('static', 'static', cache_max_age=3600)

Then in the you set the icon attribute to /static/myicon.png

contentName.attrib["icon"] = "/static/edit.png"

And that's it!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top