Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Coral UI Xtype

Avatar

Level 4

Hello All,

I am trying to add class property to granite/ui/components/coral/foundation/form/textarea resource type in .content.xml file but the class is not reflecting in the front end?

But when I add class to granite/ui/components/foundation/form/textfield resource type the class is reflecting in the front end inspect element.

Is this a limitation with Coral UI ?

thanks,

Vish

1 Accepted Solution

Avatar

Correct answer by
Level 5

There is nothing much in the above code, it should have worked. We are just trying to read the attribute from properties and adding it to the html.

Anyhow that's not right approach and I just tried to go through the coral code in detail and realized we can use as below:

granite:class - String - classname

coralui.png

Similarly you can use granite:id for id.

Check this document related to common attributes: Common Attributes — Granite UI 1.0 documentation

Check this document which mentions about granite:class : Migration Guide to CoralUI 3-based — Granite UI 1.0 documentation

View solution in original post

5 Replies

Avatar

Level 5

Hi Vishwanath,

The below code is not present in coral UI components, whereas its present in granite ui components. May be there is a reason they removed it. I have not used coral UI yet.

// Start of attrs compatibility; please use cmp.populateCommonAttrs(attrs).

attrs.add("id", cfg.get("id", String.class));

attrs.addClass(cfg.get("class", String.class));

attrs.addRel(cfg.get("rel", String.class));

attrs.add("title", i18n.getVar(cfg.get("title", String.class)));

attrs.addOthers(cfg.getProperties(), "id", "class", "rel", "title", "type", "name", "value", "emptyText", "disabled", "required", "validation", "maxlength", "fieldLabel", "fieldDescription", "renderReadOnly", "ignoreData");

// End of attrs compatibility.

You can overlay your field and add this line but let me know your requirement why you need class or id ?

Avatar

Level 4

Hi Susheel,

Unfortunately this didn't work.

Alternatively, I am using the granite UI "granite/ui/components/foundation/form/textfield" resource type for our use.

thanks,

Vish

Avatar

Level 10

Using the grainte types like granite/ui/components/foundation/form/textfield is the way to proceed.

Avatar

Correct answer by
Level 5

There is nothing much in the above code, it should have worked. We are just trying to read the attribute from properties and adding it to the html.

Anyhow that's not right approach and I just tried to go through the coral code in detail and realized we can use as below:

granite:class - String - classname

coralui.png

Similarly you can use granite:id for id.

Check this document related to common attributes: Common Attributes — Granite UI 1.0 documentation

Check this document which mentions about granite:class : Migration Guide to CoralUI 3-based — Granite UI 1.0 documentation

Avatar

Level 10

what are you trying to do with these Granite types - are you trying to overlay the look and feel of them?