Ext.BasicDialog , button with icon issue - Ext JS

Hi,

I want to add button with (text and icon) ,in dialog , but I've found a problem :
example in dialog hello example add this line :

dialog.addButton({icon:'test.gif' , text : 'test'} , dialog.hide);

the button is not visible.

Best regards.

Thank for you work jack ;-)
Reply With Quote
  # 2  
Old 02-25-2007, 08:00 AM
Default

You are missing the class. 'x-btn-text-icon'. To explain further:

Each button can have one of 3 modes:

Text-only (default), Icon-only and Text + Icon

The way of triggering a specific mode is with a CSS class:

cls: 'x-btn-icon' // icon only

cls: 'x-btn-text-icon' // icon and text

You can either set your icon inline (as you have done) or you can set 2 classes and set it in CSS:

cls: 'x-btn-icon foobar'

and add this CSS:

.foobar .x-btn-text {
background-image:url(foo.gif);
}
Reply With Quote
  # 3  
Old 02-25-2007, 08:08 AM
Default

thanks for your reply,

but if tested:
dialog.addButton({icon:'test.gif' , cls: 'x-btn-text-icon' , text : 'test'} , dialog.hide);

the problem is always present;-(
Reply With Quote
  # 4  
Old 02-25-2007, 08:37 AM
Default

Ah I didn't even notice in your first post that you are calling dialog.addButton. Look at the docs for the first param:

* @param {String/Object} config A string becomes the button text, an object is expected to be a valid Ext.DomHelper element config

It's not a Button config but a DomHelper config to make custom buttons (e.g. image buttons).

I just added to the code to sniff the object and determine if it is a Button config or DomHelper config so in the next rev you will be able to pass in a Button config as well.
Reply With Quote
  # 5  
Old 02-25-2007, 04:30 PM
Default

thanks jack ;-)
Reply With Quote
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值