-
1. Re: 'guvnorEditorObject' callback functions not working
cecchisandrone Sep 24, 2012 6:12 AM (in response to tomsebastian)Hi sebastian,
I tried with this code but tells me that guvnorEditorObject is undefined.
How do you register the callback functions? Can you show me some code?
Thanks<iframe id="myIframe" src="#{taskHome.designerUrl}"
width="100%" height="1000px" >
</iframe>
<script type="text/javascript">
function register() {
var guvnorEditorObject = window.document.getElementById('myIframe').contentWindow.guvnorEditorObject;
alert('guvnorEditorObject ' + guvnorEditorObject);
guvnorEditorObject.registerAfterSaveAllButtonCallbackFunction(function () {
alert('saved');
});
guvnorEditorObject.registerAfterSaveAndCloseButtonCallbackFunction(function () {
alert('saved and close');
});
guvnorEditorObject.registerAfterCancelButtonCallbackFunction(function () {
alert('cancel')
});
}
</script>
-
2. Re: 'guvnorEditorObject' callback functions not working
ravinandan Nov 13, 2012 5:53 AM (in response to cecchisandrone)Hello,
I'm also facing the same issue. (Using latest drools-guvnor distribution war file)
I have written the following function to register the callback functions
function register() {
var guvnorEditorObject = window.document.getElementById('myIframe').contentWindow.guvnorEditorObject;
if(guvnorEditorObject){
//guvnorEditorObject.getDRL(function(drl){alert('drl: '+drl);})
//guvnorEditorObject.getBRL(function(brl){alert('brl: '+brl);})
guvnorEditorObject.registerAfterSaveAndCloseButtonCallbackFunction(function(){guvnorEditorObject.getDRL(function(drl){alert('drl: '+drl);window.close();})});
guvnorEditorObject.registerAfterCancelButtonCallbackFunction(function(){alert('Cancel button clicked');});
}else{
setTimeout(register,250);
}
}
When I click on "Close" button nothing happens.
Any help welcome!
Thanks,
Ravi
-
3. Re: 'guvnorEditorObject' callback functions not working
ravinandan Nov 14, 2012 4:21 AM (in response to ravinandan)I had a look at source code (5.4) in StandaloneEditorManager
I removed the following line in JS native method afterCloseButtonCallbackFunction(),
$wnd.opener.location.reload();
Here is the updated code function:
public native void afterCloseButtonCallbackFunction()/*-{ if (confirm("Are you sure you want to close this window?")) { $wnd.close(); } }-*/; Now I'm able to see the prompt asking for the user to close window or not.
But still the window is not closing after selecting OK.
I'm using JSF-Richfaces modalpanel along with an iframe to show the custom editor.
Maybe $wnd.close(); does not know how to close the modalpanel?
-
4. Re: 'guvnorEditorObject' callback functions not working
amiskuma Sep 16, 2014 5:39 AM (in response to tomsebastian)Hi Sebastian,
Did you find any work around for this. save all changes is working properly for me but even I could not find the way to register close button. none of the callback methods get called for close button in StandaloneEditor.html. let me know if anything you found.
Thanks,
Amish.