In respect of Extjs 4.1.x I was able to use custom/wrapper library to manipulation model
, store
, view
, controller
as well as other utilities. So my demand is to replace boiler plate of code through my custom/wrapper library. Regarding the code as bellow:-
var Lib = Lib || {
$class : 'Lib',
$package : 'Default',
version : '1.0.00',
getName : function(){
return Lib.$class;
},
define : function(name, config){
return Ext.define(name, config);
}
};
is my custom library, right now I would like to replace the following code
Ext.define('Myapp.view.main.MainModel', {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.main',
data: {
name: 'Myapp'
}
});
as bellow the replacement/wrapper of Extjs code:
Lib.define('Myapp.view.main.MainModel', {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.main',
data: {
name: 'Myapp'
}
});
But here is the problem cause Sencha CMD 5.x build error where previous version of Sencha SDK, CMD support to use 3rd party library simply use it in index.html
<script id="extwrapper" type="text/javascript" src="Lib.js"></script
but latest Sencha CMD 5.x with Extjs 5.x occurred compilation error. Any way I would like to use custom/wrapper library instead of Extjs 5.x use directly. Do you have any hacks? While I tried by adding my customer/wrapper library in app.json
as
"js": [
{
"path": "${ext.dir}/build/ext-all-rtl-debug.js"
},
{
"path": "${ext.dir}/Lib.js",
"bootstrap": true
},
{
"path": "app.js",
"bundle": true
}
],
still its appear Sencha CMD 5.x build error. Any kind of reference does not support on className
even java script closure/inline function. for example
Ext.define((function(){ return 'Myapp.view.main.MainModel';})(), {
extend: 'Ext.app.ViewModel',
alias: alias,
data: {
name: 'Myapp'
}
});
on data
it's support simple java script closure/inline function but no reference. for example
Ext.define( 'Myapp.view.main.MainModel', (function(){
return {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.main',
data: {
name: 'Myapp'
}
}
})());
even when I am going to use simple reference it does not work. for example
Ext.define( 'Myapp.view.main.MainModel', (function(){
var data = {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.main',
data: {
name: 'Myapp'
}
};
return data;
})());
Build Failure for code as above I mentioned
Sencha Cmd v5.0.2.270
[INF] Processing Build Descriptor : default
[INF] Loading app json manifest...
[WRN] C1003: Unsupported Ext.define syntax (function does not return object lite
ral) -- g:\js\extjs\myapp\app\view\main\MainModel.js:1
[WRN] C1003: Unsupported Ext.define syntax (function does not return object lite
ral) -- g:\js\extjs\myapp\app\view\main\MainModel.js:1
[ERR] C2008: Requirement had no matching files (Myapp.view.main.MainModel) -- g:\j
s\extjs\myapp\app\view\main\Main.js:12:50
[ERR]
[ERR] BUILD FAILED
[ERR] com.sencha.exceptions.ExBuild: Failed to find any files for g:\js\extjs\my
app\app\view\main\Main.js::ClassRequire::Myapp.view.main.MainModel
[ERR]
[ERR] Total time: 7 seconds
[ERR] The following error occurred while executing this line:
g:\js\extjs\myapp\.sencha\app\build-impl.xml:376: The following error occurred whi
le executing this line:
g:\js\extjs\myapp\.sencha\app\init-impl.xml:292: com.sencha.exceptions.ExBuild: Fa
iled to find any files for g:\js\extjs\myapp\app\view\main\Main.js::ClassRequire::
Myapp.view.main.MainModel
Where is the problem? There was no restriction with Extjs 4.1.3 with previous version Sencha SDK/CMD. but why they added such type of feature?
By Extjs-4.1.3 I was able to write and compile as the code as bellow
Ext.define(Lib.view.getAbsView('V01I001001X01'), {
extend : 'Ext.form.Panel',
alias : Lib.app.getAlias('V01I001001X01'),
id : 'V01I001001X01'.toLowerCase(),
bodyStyle : {
background : 'none'
},
defaults : {
//TODO
},
initComponent: function() {
var me = this;
//TODO
me.callParent(arguments);
}
});
Which one work as like as hard code as bellow
Ext.define('Myapp.view.m01001.m0i001.v01i001001.V01I001001X01'), {
extend : 'Ext.form.Panel',
alias : 'widget.v01i001001x01'
id : 'v01i001001x01',
bodyStyle : {
background : 'none'
},
defaults : {
//TODO
},
initComponent: function() {
var me = this;
//TODO
me.callParent(arguments);
}
});