PDA

View Full Version : Minified code has errors in Code - whereas unminified code works perfectly



RamalingamS
11 Dec 2012, 9:01 AM
Actually the post contains 2 questions

1) The following code snippets when part of the files that are minified using Sencha Cmd's
Sencha app Build - produces errors

{
xtype : 'fieldcontainer',
combineErrors : true,
msgTarget : 'qtip',
fieldLabel : 'Campaign Type',
allowBlank : false,
defaults : {
hideLabel : true,
width : 330
},
items : [{
xtype : 'radiogroup',
id : 'campaignTypeRadioGroup',
name : 'campaignType',
columns : 2,
vertical : true,
fieldLabel : 'Campaign Type',
layout : 'hbox',
items : [{
checked : true,
boxLabel : 'Ad-Hoc  ',
name : 'campaignType',
inputValue : 'N'

}, {
boxLabel : 'Re-curring',
inputValue : 'Y',
name : 'campaignType'
}]
}]
},



{
xtype : 'fieldcontainer',
combineErrors : true,
msgTarget : 'qtip',
fieldLabel : 'Campaign Type',
allowBlank : false,
defaults : {
hideLabel : true,
width : 330
},
items : [ {
xtype : 'radiogroup',
id : 'requestcampaignTypeRadioGroup',
name : 'campaignTypeInd',
vertical : true,
layout : 'hbox',
items : [{
boxLabel : 'Ad-hoc',
inputValue : 'N',
checked : true,
name : 'campaignTypeInd'
}, {
boxLabel : 'Re-curring',
inputValue : 'Y',
name : 'campaignTypeInd'
}]
}]
}




{
xtype : 'radiogroup',
width : 500,
id : 'campaignTypeRadioGroupAS',
fieldLabel : 'Campaign Type',
labelSeparator : '',
labelWidth : 130,
labelAlign : 'left',
vertical : true,
margin : '5 5 3 5',
items : [
{
boxLabel : 'Ad-Hoc',
inputValue : 'N',
name : 'campaignType'
},
{
boxLabel : 'Re-curring',
inputValue : 'Y',
name : 'campaignType'
},
{
boxLabel : 'Both',
name : 'campaignType',
checked : true,
///Need to repalce this with the correct input value
inputValue : 'B'

} ]
}

-----------------------
2) Even after removing the above snippets rendering of the viewport fails with the following message


TypeError: 'null' is not an object (evaluating 'u.dom')

Issue appears after the Viewport's initComponent has been Completed


callee is "doInsert" in the class "Ext.dom.Helper"
Called by "append" in the Ext.dom.AbstractHelper
called by "render" in the Ext.util.Renderable
called by the "constructor" in the Ext.AbstractComponent
called by the "callParent" in the "Ext.Base"
called by the "constructor" in the Ext.Component


The arguments passed on the anonymous method called by doInsert is


0: null
1: Object - cls: "x-panel x-panel-default"
id: "ext-comp-1012"
style: Object
tag: "div"
tpl: Object
$name: "doRenderBody"
$owner: function j() {return this.constructor.apply(this,arguments)||null;}
$childEls: Array[1]
$className: "Ext.layout.container.Container"
$isClass: true
2: undefined
3: "beforeend"
4: ""
5: true

Any help would be appreciated

tschortsch
15 Dec 2012, 8:17 AM
I had a similar problem with the minifying process. After creating a production build I always got errors with the Leaflet-Library which uses L as namespace.
After some research I found out that minifying the microloader (in index.html) was the problem. It also used L as variable name, which resulted in complications.

As a workaround I removed the line in Sencha Cmd where the microloader gets minified.

/<Sencha Cmd Verzeichnis>/plugins/touch/current/app-build.js line 362
//content = compressor.compress(content);

After this my production build worked without any problems.

I'm not sure if this helps resolving your problem.

Greetings
tschortsch

Malliga
21 Dec 2012, 5:49 AM
First tschortsch.
Thanx for your input

After long research found that the sencha and build command had issues with the application workspace generated and not the file structure.

Finally tried out the sencha single page build process using the compile

sencha compile -classpath=ext-4.1/src,app page -in indexOriginal.jsp -out build/index.jsp


Issues
1) Layouts used for field containers were never added to concatenated all-classes.js code. Solution used was to add them explicitly using the Ext.require();
2) requires :[] references in the various components created problem in concatenated build as the application creation was done at a later stage. Solution - removed requires references from all models, stores & views.
3) controllers are now not added in the generated all-classes.js - Solution - Not yet found

RamalingamS
21 Dec 2012, 5:56 AM
Thank you tschortsch your input is valid for touch users. we found that only later. We were using EXTJS.

Like Malliga we also used
sencha compile -classpath=ext-4.1/src,app page -in index.jsp -out build/index.jsp
and found almost the same issues
Sencha Cmd not adding controllers in the concatenated ouput in unbelievable.

out index.jsp looked like this


<!-- <x-compile> -->
<!-- <x-bootstrap> -->
<script type="text/javascript" src="ext-4.1/ext-all-debug.js"></script>
<!-- </x-bootstrap> -->
<script type="text/javascript" src="app/app.js"></script>
<script type="text/javascript" src="app/all-classes.js"></script>
<!-- </x-compile> -->


Does Sencha Cmd produce any reliable build output with the controllers in it???

RamalingamS
21 Dec 2012, 6:24 AM
Tried to see if the metadata generator is able to locate the controllers in the application



sencha compile -classpath=ext-4.1/src,app page -i indexOriginal.jsp -out build/index.jsp and metadata -m -json -o Metadata.json


Please find attached the meta-data.

None of the controllers has been added in the meta-data.

is there a separate command or instruction to do the same.

Dont Controllers also get generated in the all-classes.js??? file

Any help would be greatly appreciated

RamalingamS
21 Dec 2012, 6:27 AM
Found out that the xtype was not determinable by EXTJS for Radio group's child components.

Explicitly added the widget.radio in the Ext.require('') and it started to work fine for the viewport rendering.