Hi,
I used the command c:load and it works good, but now i want to load with the "populator" object when click on the toolbarbutton.
Here is my old code :
<b:tab label="Demandes d'emploi" padding="5px 10px" >
<b:toolBar class="MenuDansOnglet">
<b:toolBarButton id="ListerCV">
<img alt="Lister" src="images/lister.png" style="height: 24px; width: 24px;"/>
Lister les CVs
<e:handler event="click">
<c:load url="./xml/ListeCV.xml" destination="id('ZoneRechercheEmploi')" mode="replaceChildren"/>
</e:handler>
...
<b:toolBar class="MenuDansOnglet">
<b:toolBarButton id="ListerCV">
<img alt="Lister" src="images/lister.png" style="height: 24px; width: 24px;"/>
Lister les CVs
<e:handler event="click">
<c:load url="./xml/ListeCV.xml" destination="id('ZoneRechercheEmploi')" mode="replaceChildren"/>
</e:handler>
...
Here is my new code :
<b:tab label="Demandes d'emploi" padding="5px 10px" >
<b:toolBar class="MenuDansOnglet">
<b:toolBarButton id="ListerCV">
<img alt="Lister" src="images/lister.png" style="height: 24px; width: 24px;"/>
Lister les CVs
<b:populator url="" events="click" type="always">
<e:handler event="DOMNodeInsertedIntoDocument" type="application/javascript">
this.setAttribute('url','./xml/ListeCV.xml')
</e:handler>
</b:populator>
...
<b:toolBar class="MenuDansOnglet">
<b:toolBarButton id="ListerCV">
<img alt="Lister" src="images/lister.png" style="height: 24px; width: 24px;"/>
Lister les CVs
<b:populator url="" events="click" type="always">
<e:handler event="DOMNodeInsertedIntoDocument" type="application/javascript">
this.setAttribute('url','./xml/ListeCV.xml')
</e:handler>
</b:populator>
...
I've got some problems :
- The content of ListeCV.xml is loaded into the button :) , so i don't know how to put the 'destination' attribute for pointing into the correct div (ZoneRechercheEmploi).
- The loading message is inside the toolbarbutton and not on the top on my div ZoneRechercheEmploi.
Thank you in advance

c:load and b:populator
25 February, 2008 - 11:53 — yudiHi zoizo,
Problems1:The content of ListeCV.xml is loaded into the button :) , so i don't know how to put the 'destination' attribute for pointing into the correct div (ZoneRechercheEmploi).
answer: You should not put the populator inside the button but you should put the populator on the destination (div). In button ,you should define click handler that dispatch populated event that trigger populator to populate.
var oEvent = bb.document.createEvent("Events");
Event.initEvent("populated", true, true);
this.dispatchEvent(oEvent);
</e:handler>
<div id="ZoneRechercheEmploi">
<b:populator url="populatorAlways.xml" events="populated" type="always" >
</div>
Problems2:The loading message is inside the toolbarbutton and not on the top on my div ZoneRechercheEmploi.
answer: This happens because you put the populator inside the toolbarbutton.Therefore, you should put the populator inside your div.
~Yudi
c:load and b:populator
25 February, 2008 - 12:30 — zoizoHi Yudi,
Thanks for your fast reply.
I got a new error : GENERIC: Javascript error: "Event.initEvent is not a function". b:toolBarButton anonymous()
Maybe a different way to write it.
c:load and b:populator
25 February, 2008 - 13:00 — yudiHi zoizo,
I mistyped it that's why it gives a javascript error "Event.initEvent is not a function". It should be oEvent.initEvent not Event.initEvent
Cheers,
Yudi
c:load and b:populator
25 February, 2008 - 14:07 — zoizoHi Yudi,
Thanks for the solution, i haven't got any errors now, but it not seems to work properly because i haven't got the message : Loading, please wait...
Second point : Is the attribute "url" required for b:populator ? Or is it optional ? beacause in my case I don't want to put any url, coz the informations are generated by a CGI or load via an xml when I click the toolbarbutton.
If you want to see clear please : www.http-interactive.fr/ElanRH
For example I need a loading message for "Demande d'emploi">"Lister CV"
Best regards and thx for all
c:load and b:populator
25 February, 2008 - 14:41 — yudiHi zoizo,
Yes , the "url" attribute is necessary because it specifies the data's location. Populator is used to load data and also provide a loading message while the data is still loading. This is different from c:load, c:load only loads data but has no loading message.
If you already have a function to load the data and only want a loading message when data is loading , then you can use b:loadingMessage. I use your c:load and combine with b:loadingMessage for this example.
<p>This is only an example.</p>
</b:loadingMessage>
<e:handler event="select" type="application/xml">
<c:show with="id('sampleLoadingMessage')" />
<c:load url="./xml/ListeCV.xml" destination="id('ZoneRechercheEmploi')" mode="replaceChildren"/>
<c:hide with="id('sampleLoadingMessage')" />
</e:handler>
It Work's :)
25 February, 2008 - 15:12 — zoizoOk it works and it's exactly what I want.
Thanks you very much Yudi for your help.