PDA

View Full Version : Problems with load classes in app



whyte624
28 Jul 2011, 7:37 PM
I'm triing to create app with ext js MVC structure.
One of my controllers named LayoutPlaces has several views:

views: [
'common.YesNoComboBox',
'common.SearchField',
'LayoutPlaces.Grid',
],

Then in Grid columns I'm using YesNoComboBox


columns: [
{header: 'Id', dataIndex: 'id', hidden: true},
{header: 'Code', dataIndex: 'code'},
{header: 'Name', dataIndex: 'name', flex:1},
{header: 'Visible', dataIndex: 'visible',
editor: Ext.create('App.view.common.YesNoComboBox') }
},
],

When I'm loading page I see js error: Uncaught TypeError: object is not a function
This error occus in row:

editor: Ext.create('App.view.common.YesNoComboBox')

After few refreshes of page (F5) error dissapears. But in some of next refresh it appears again.
I can do nothing, because this error is random.

I guess this error because of different time of loading of js files with my ext js components, i.e. 'LayoutPlaces.Grid' file loads early than 'common.YesNoComboBox' sometimes.

Jacky Nguyen
30 Jul 2011, 8:03 PM
Are you using ext-dev.js? If not please do so during development. There should be a much clearer error message thrown from Ext.Loader.

mankz
31 Jul 2011, 2:58 AM
You need to start using a syntax checker. I spot 2 extra commas which usually cause unpredictable results...

vividvr
31 Jul 2011, 10:27 PM
I have the same problems,anyone can help us to solve the problem,thanks very much!

whyte624
8 Aug 2011, 4:02 AM
Are you using ext-dev.js? If not please do so during development. There should be a much clearer error message thrown from Ext.Loader.
I had used bootstrap.js before. Now I've added ext-all-dev.js. And my guesses was right.
Sometimes YesNoComboBox.js loading before Grid - and I see no error.
But sometimes Grid loading before than YesNoComboBox.js. In that case I see:

warning - [Ext.Loader] Synchronously loading 'App.view.common.YesNoComboBox'; consider adding Ext.require('App.view.common.YesNoComboBox') above Ext.onReady
error - name / alias: App.view.common.YesNoComboBox

I've added direct loading of my additionalcomponents in <head>, but this is hack and not solution.

blocksr
10 Aug 2011, 4:35 AM
oh,sorry,i think i make a mistake.

whyte624
15 Aug 2011, 10:36 PM
I've added direct loading of my additionalcomponents in <head>, but this is hack and not solution.
I've searched some more information and discovered sencha sdk tools (http://www.sencha.com/products/sdk-tools/). JSBuilder writes used classes in right direction and I have no problems with loading of separate files.
I think this is right solution for my problem.