Widget not apply context

1
I create custom widget which communicate with Applet to get String from Applet as a signature data and capture to database. But it seem like the applyContext did not run correctly so I get empty Object all the time. Please see my Code in Java Script below Can Anyone Help me? dojo.provide("SignPadModule.SignPadModule"); mendix.widget.declare("SignPadModule.SignPadModule",{ addons : [dijit.Templated, mendix.addon.Contextable ,mendix.addon._Scriptable], templatePath : dojo.moduleUrl('SignPadModule', "ui/SignPad.html"), inputargs : { ContentData : '', SignData : '', executeMicroflow : '' }, // Global variables dataobject : null, isInactive : false, postCreate : function(){ this.initContext(); this.actRendered(); this.connect(this.buttonNode, "onclick", dojo.hitch(this, this.onclick)); this.offerInterfaces(["close"]); }, onclick : function (e){ this.startmywidget(this.dataobject); }, // Here we receive the context and use it to retrieve our object. We also subscribe to any commits of the object elsewhere. applyContext : function(context, callback) { if (context) mx.processor.getObject(context.getActiveGUID(), dojo.hitch(this, function(object) { if (object != null) { this.dataobject = object; mx.processor.subscribeToGUID(this, object.getGUID()); } })); else logger.warn(this.id + ".applyContext received empty context"); callback && callback(); }, startmywidget : function (object) { // Your code goes here. object.setAttribute(this.SignData, this.smcApplet.getSignString('AAA')); object.save({ error : dojo.hitch(this, this.feedbackError, "Error while saving object"), callback : dojo.hitch(this, this.invokeMF, object) }); }, invokeMF : function(object) { //invoke microflow mx.processor.xasAction({ error : function() { logger.error(this.id + "error: XAS error executing microflow"); }, actionname : this.executeMicroflow, guids : [object.getGUID()], callback : dojo.hitch(this, this.processOutput), applyto : 'selection', caller : this }); }, // This is called when you are subscribed to an object and it is committed. objectUpdate : function(object) { this.UPDATEOBJECT(object); }, _setDisabledAttr : function(value) { this.isInactive = !!value; this.domNode.attr("disabled", this.isInactive); }, // Here we unsubscribe to our object to clean up. uninitialize : function(){ mx.processor.unSubscribeFromGUID(this, this.dataobject.getGUID()); }, close : function() { this.disposeContent(); }, processOutput : function(output) { logger.debug(this.id + ".processOutput"); processedOutput = dojo.fromJson(output.xhr.responseText); //alert(processedOutput['actionResult']); } });
asked
2 answers
1

i have insert alert('1'); after "initcontext();" and its give me alert on running. its seem like initialcontext is run but it run without applycontext(); anyone help me?

answered
0

In your widget xml, did you set needsEntityContext="true" in the widget tag?

answered