KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am really a newbie to dojo but as i started developing a new application with dojo version 1.7.2 i also wanted to use the new AMD syntax for functions. Unfortunately i don't seem to get it. :-( What annoys me most is that i can't simply call any function which is inside of a "require"-block. For example i have a page which on opening creates a dynamic table with several widgets in each row. Then i have a button which adds one empty row each time pressed. Without AMD syntax it would be easy: - put all my "dojo.require()" in the HEAD - and then create a bunch of my own functions for creating the table and widgets - the add row function could easily access any global-variables my previous function filled But with AMD its like this: Initial function creates the table and widgets: function fillReportTable(repId) { require(["dojo/dom-construct", "dojo/dom-attr", "dijit/form/FilteringSelect", "dojo/data/ItemFileReadStore", "dijit/form/ComboBox", "dijit/form/DateTextBox", "dijit/form/Select", "dojo/store/Memory"], function (domConstruct, domAttr, FilteringSelect, ItemFileReadStore, ComboBox, DateTextBox, Select, Memory) { // a lot of code to create the table, consisting of SEVERAL functions function createNewRow(tbl) { ...} function function1 () {... } function function2 () {... } function function3 () {... } } Now the "Add Empty Row" button calls its own function "addEmptyRow". But in this function I have to: - do an other require for each dojo-module again - I CAN'T use any of the functions which are "inside" of the "fillReportTable"-function. For example the "createNewRow"-function function addEmptyRow() { require(["dojo/dom-construct", "dojo/dom-attr", "dijit/form/FilteringSelect", "dojo/data/ItemFileReadStore", "dijit/form/ComboBox", "dijit/form/DateTextBox", "dijit/form/Select", "dojo/store/Memory"], function (domConst
Tags (comma-separated)
Save Edits
Cancel