External Javascript

2
Oki i will ask another way. I have removed my external JS file from widget, just for the test. No i have in main file some usual functions like postCreate, uninitialize and so on. But i have another functions there: f1: function() {this.f2();}, f2: function() {},.... In postCreate i am setting my button on HTML: initSaveRotaButton: function() { this.saveButton.value = "Save"; this.connect(this.saveButton, "onclick", dojo.hitch(this, this.f1)); },... But when i hit the button, mendix says: f2 is not defined [Zastavit při této chybě] (138 out of range 14) Any help?
asked
2 answers
0

absolutely...

Widget.js:

dojo.provide("StaffRota.widget.StaffRota");

mendix.dom.insertCss(mx.moduleUrl("StaffRota", "widget/ui/staffrota.css"));

dojo.require("StaffRota.widget.jquery");
dojo.require("StaffRota.widget.jquery-ui");
dojo.require("StaffRota.widget.mlv-utils");
mendix.widget.declare("StaffRota.widget.StaffRota", {
......

initSaveRotaButton: function() {
        this.saveButton.value = "Save";

        this.connect(this.saveButton, "onclick", dojo.hitch(this, this.saveStaff));
    }

initSaveRotaButton() is called in postCreate function.

saveStaff: function() {
        TableController.xxx();
    },

mlv-utils.js:
dojo.provide("StaffRota.widget.mlv-utils"); 
var TableController = {
   xxx:function() { alert('test');};
answered
0

when i have my main widget file:

and i have three functions

f1: function() {... this.f2();....}, f2: function() {... this.f3();....}, f3: function() {....} can i in another function do this?

anotherFunction() { this.f1(); }

Because it looks like he cant call nested function. Because first function is called, but after that he say i dont know function f2.

Can anybody help?

answered