View Full Version : How to fire event when element is added to panel

23 Jan 2014, 2:13 AM
Hi All,

I have a panel, i'm updating panel with .svg file.

var panel = Ext.ComponentQuery.query('panel')[0];
panel.update('<object type="image/svg+xml" data="images/path_to_mysvg_image.svg" x="0" y="0"> </object>');

After executing this file when i'm inspecting the elements following elements are added to panel.

<object type="image/svg+xml" data="BlueSageVisio.svg" x="0" y="0"> </object>
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<!-- Generated by Microsoft Visio 11.0, SVG Export, v1.0 BlueSageVisio.svg Page-1 -->

<svg xmlns="http://www.w3.org/2000/svg" xmlns:v="http://schemas.microsoft.com/visio/2003/SVGExtensions/" width="8.26772in" height="11.6929in" viewBox="0 0 595.276 841.89" xml:space="preserve" xmlns:xml="http://www.w3.org/XML/1998/namespace" color-interpolation-filters="sRGB" class="st9">
<v:documentProperties v:langID="1033" v:viewMarkup="false"/> <defs id="Markers"> <g id="lend4">
<path d="M 2 1 L -0 0 L 2 -1 L 2 1 " style="stroke:none"/>
<marker id="mrkr4-10" class="st5" v:arrowType="4" v:arrowSize="2" v:setback="23.0021" refX="-23.002100210021" orient="auto" markerUnits="strokeWidth">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#lend4" transform="scale(-11.501050105011,-11.501050105011) "/>

Now my requirement is to fire an event when each element of image is adding to panel.

Can anybody has some idea?


6 Feb 2014, 11:40 AM
So after the panel.update method call, you can use the panel.fireEvent method:

panel.fireEvent('someevent', panel, anotherargument);