headkit
headkit

Reputation: 3327

sencha touch :: adding multiple classes to buttons

is there a way to add multiple classes to a panel or button in sencha touch? I tried to add more than one with "cls:'newClass secondClass'," but it seems I can only add one class...

Upvotes: 1

Views: 8846

Answers (2)

thomasb
thomasb

Reputation: 95

you can achieve this by passing an array of strings

cls: ['class1', 'class2'],

see: http://docs.sencha.com/touch/2.3.1/#!/api/Ext.Component-cfg-cls

Upvotes: 3

YDL
YDL

Reputation: 714

You can use the .addCls function for that.

For example:

button.addCls('class1 class2 class3');

The HTML output of the button will now be:

<div id="ext-comp-1064" class="x-button x-button-normal x-button-action class1 class2 class3" style="margin-top: 8px; height: 30px; "><span class="x-button-label" id="ext-gen1116">Label</span></div>

Upvotes: 3

Related Questions