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
Post a Comment