javascript - How to call method from a controller to another controller appcelerator -


i'm build application appcelerator-studio.

the application create programmatically table code:

controller.js

    var rowdata = [];      var header = alloy.createcontroller('result_row_header',{         examination:titanium.locale.getstring(lang+"examination"),         start_date:titanium.locale.getstring(lang+"start_date"),         end_date:titanium.locale.getstring(lang+"end_date")     });     var viewheader = header.getview();       //disegno la testata     rowdata.push(viewheader);      $.table.setdata(rowdata);   function set_fields(lang) {     header.changelanguage(lang); } 

result_row_header.js

var args = arguments[0] || {};  $.examination.text = args.examination;  $.start_date.text = args.start_date;  $.end_date.text = args.end_date;   function changelanguage(lang){     $.examination.text=titanium.locale.getstring(lang+"examination"); } 

now want call changelanguage method controller.js if try execute method set_fileds (from controller.js) have error.

just little change in code:

result_row_header.js

var args = arguments[0] || {};  $.examination.text = args.examination;  $.start_date.text = args.start_date;  $.end_date.text = args.end_date;  // code access function of controller other $.changelanguage = function (lang){     $.examination.text=titanium.locale.getstring(lang+"examination"); }; 

rest of code remains same.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -