PDA

View Full Version : xds_index.js file question



berntkau
26 May 2010, 8:55 AM
Hi! I've succeeded in creating a viewport with tree, grids and tabpanels in different regions and with business logic that loads data depending on selections. This is my 'application' part.

So far I had a xds_index.js rendered with the following content:

Ext.onReady(function() {
var myVieport = new MyViewport({
renderTo: Ext.getBody()
});
myViewport.show();
});

From the forums I learned it was possible to add 'main level' objects in a single project. So I wanted to add a login form. Added this in a window MyLoginWindow. When I export the project the following xds_index.js is generated:

Ext.onReady(function() {
var myLoginWindow = new MyLoginWindow({
renderTo: Ext.getBody()
});
myLoginWindow.show();
var myViewport = new MyViewport({
renderTo: Ext.getBody()
});
myViewport.show();
});

This will make both visible. Of course I'd want only the login window to show up and when a successful login is made, the 'application' MyViewport would be shown.

Now I edit the xds_index.js erase and move the show command into the MyLoginWindow.js which is the correct place for custom code. It works but I have to remember to remove the show command from the generated file every time i export.

Is there a way to prevent the show command to be generated for each 'main level' object? Or, are there any issues with the way I try to work this out?

Would appreciate any ideas and suggestions.

jarrednicholls
26 May 2010, 9:57 AM
Hi Bernt,

We're considering making it a toggle/option for both instantiating 'top level' components and showing them...individual components of course. However in the meantime, I recommend making copies of the xds_index.js and xds_index.html files (and change the reference to xds_index.js's copy accordingly), so that you can alter them without them being overwritten upon subsequent exports.

Thanks.

berntkau
26 May 2010, 11:25 PM
Hi Jarred!

Thank you for your reply. Your solution will be functional for me.

(I'll also try to learn and use the correct terminology.)

jarrednicholls
27 May 2010, 5:18 AM
Haha, that was just my choice of word, wasn't going against you on purpose, sorry! "main level" and "top level" are synonymous in my book :-)