BasicDialog autoCreate - Ext JS

I don't quite understand what the autoCreate config does in the BasicDialog constructor.

I've got an existing div with some content that I want to be displayed in a BasicDialog box.
Is there an option to just put the appropriate wrappers around my div and it be displayed in the dialog? Is that the autoCreate (wrappers)?

Is this even possible or do I have to go add all the appropriate classes to the div's I wanted displayed?
Reply With Quote
  # 2  
Old 03-09-2007, 02:13 AM
Default

If you have existing content, don't use autoCreate.

Try

[code]
...
var myDlg = new Ext.BasicDialog("my-dialog", {...});
</script>
</head>
<body>
<div id="my-dialog">
<div id="my-dialog-body">
Content...
</div>
</div>
[/cide]
Reply With Quote
  # 3  
Old 03-09-2007, 08:42 PM
Default

so what is autoCreate used for then?

how do you add body content to a dialog that has been autoCreate'd?
Reply With Quote
  # 4  
Old 03-09-2007, 09:16 PM
Default

With autoCreate, Ext will generate the needed markup for you. You can always get a reference to the body's dom node and write whatever you want into its innerHTML, the same as if you had static content already there at design time.
__________________
Brian Moeskau
FAQ / Tutorials / User Extensions / Enhanced Forum Search
Reply With Quote
  # 5  
Old 03-09-2007, 11:32 PM
Default

Its getting a reference to the body's dom node part that I dont understand...

If I use "autoCreate: true" in the dialog config, then it creates a dialog body with a random id (ie: ext-gen8), so how do I get that dom node id?
Reply With Quote
  # 6  
Old 03-10-2007, 12:23 AM
Default

Sometimes reading the docs helps, even in alpha stage
See the first item in the public properties list of the BasicDialog docs.
Reply With Quote
  # 7  
Old 03-10-2007, 08:19 AM
Default

Quote:
Originally Posted by VinylFox
Its getting a reference to the body's dom node part that I dont understand...

If I use "autoCreate: true" in the dialog config, then it creates a dialog body with a random id (ie: ext-gen8), so how do I get that dom node id?
yourDialog.body.id
:wink:
__________________
Ext readings for beginners | Ext manual's resources section | Ext documentation center | Ext Tutorials | Ext screencasts | Ext FAQs | Ext Forum Index | Various Debugging Tools for IE & Firefox

My Ext's Wiki user page
Reply With Quote
  # 8  
Old 03-10-2007, 09:40 AM
Default

haha....its the very first one....sometimes i just wish i could kick myself

I sware I really did read the docs, I dont know how I managed to miss that.
Reply With Quote
  # 9  
Old 03-10-2007, 10:05 AM
Default

So it seems like the answer to INeedADip's questions would be to do something like this...

	dialog = new Ext.BasicDialog("my-dialog", { 
       ...
       autoCreate: true,
       ...
});
	
document.getElementById(dialog.body.id).innerHTML = document.getElementById('my-div').innerHTML;
then your div with content in your html would be displayed in the popup...

	<body>
		<div id="my-div">Content...</div>
	</body>
Reply With Quote
  # 10  
Old 03-10-2007, 10:23 AM
Default

Carefull just copying the innerHTML from one DIV to another...especially if there are named fields or objects.
Reply With Quote
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值