I have two Webparts on a sharepoint site ... thats basicly like haveing two iframes . What I want to do is if there is a change at webpartA , I want to update WebpartB ... what I did so far is at WebpartA I try to trigger a custom event:
$("#datain").change(function () {
parent.$("document").trigger("datachange" , [$("#datain").val()]);
})
At Webpart BI added a Eventlistener :
parent.$("document").on('datachange',function (event, data) {
$("#dataout").html(data);
});
When I change something at WebpartA , the event is triggered , but it never reaches the event listener at WebpartB. Is there something wrong with my code or is it just impossible to communicate between the two iframes with custom Events ?
Thank you for your help.
fixxed the problem by changeing "document" to "body" so Webpart A is :
$("#datain").change(function () {
parent.$("body").trigger("datachange", [$("#datain").val()]);
})
and Webpart B is :
parent.$("body").on('datachange',function (event, data) {
$("#dataout").html(data);
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.