Coral UI Xtype | Community
Skip to main content
Level 4
July 28, 2017
Solved

Coral UI Xtype

  • July 28, 2017
  • 5 replies
  • 2668 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by susheel

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

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

5 replies

susheel
Level 5
July 29, 2017

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 ?

Level 4
August 2, 2017

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

smacdonald2008
Level 10
August 2, 2017

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

susheel
susheelAccepted solution
Level 5
August 3, 2017

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

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

smacdonald2008
Level 10
August 3, 2017

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