Content element inside Toolbar component doesn't work - css

I'm trying to build a table with button on table's header. I'm guiding from here.
This is my code:
<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m"
xmlns:l="sap.ui.layout"
xmlns:f="sap.ui.layout.form"
xmlns:t="sap.ui.table"
height="100%"
controllerName="xxxxx"
xmlns:html="http://www.w3.org/1999/xhtml">
<Page title="CONFIGURACIÓN DE LA CUENTA" navButtonPress="onCancel" showNavButton="true">
<content>
<f:SimpleForm id="form_requerimiento_datos_generales" minWidth="1024"
maxContainerCols="2" editable="true" layout="ResponsiveGridLayout"
labelSpanL="4" labelSpanM="4"
emptySpanL="0" emptySpanM="0" columnsL="2" columnsM="2"
validateFieldGroup="onValidateFieldGroup">
<f:content>
<core:Title text="Suscripciones"/>
<t:Table
rows="{/Subscriptions?$filter=UserSystem eq '1'}"
selectionMode="None"
visibleRowCount="7">
<t:toolbar>
<content>
<Title id="title" text="Listado de Suscripciones" />
<ToolbarSpacer/>
<Button
icon="sap-icon://add"
tooltip="Agregar Suscripciones"
press="addSuscription"/>
</content>
</t:toolbar>
<t:columns>
<!--columns-->
</t:columns>
</t:Table>
</f:content>
</f:SimpleForm>
</content>
</Page>
</core:View>
I have following error message:
Uncaught Error: failed to load 'sap/m/content.js' from https://sapui5.netweaver.ondemand.com/resources/sap/m/content.js: 0 - NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'https://sapui5.netweaver.ondemand.com/resources/sap/m/content.js'.
I don't know why I get this error. I think that It's in this part of code:
<t:toolbar>
<content>
<Title id="title" text="Listado de Suscripciones" />
<ToolbarSpacer/>
<Button
icon="sap-icon://add"
tooltip="Agregar Suscripciones"
press="addSuscription"/>
</content>
</t:toolbar>
I don't know why content label is not accepted inside toolbar label (In example this works). When I take off content label of my page. I don't get error messages.
I would like to know what doing for to solve my problem.
Thanks for help me!
UPDATE 1
I solved already my problem but Now I have another problem. I have a problem with CSS of table header (This is overlapped with table body):

The label <t:toolbar> is the aggregation name and it expects a toolbar inside it.
So, ideally <t:toolbar> is followed by a sap.m.Toolbar control.
As to why it is throwing: sap/m/content error is because, it is expecting a control after the <t:toolbar>. Also, since your default namespace is sap.m so it looks for control ( in this case you have specified content) in the default namespace.There is no such control as sap.m.content. Thus, an error.
If you will check your guiding source, you will see they have an <m:Toolbar> after <toolbar> aggregation
Here is the updated code:
<t:toolbar>
<Toolbar>
<content>
<Title id="title" text="Listado de Suscripciones" />
<ToolbarSpacer/>
<Button
icon="sap-icon://add"
tooltip="Agregar Suscripciones"
press="addSuscription"/>
</content>
</Toolbar>
</t:toolbar>

Related

How to disable checkboxes 's option in dialog.xml in CQ5 AEM?

I have designed my CQ5 dialog as given in the following image. I have to disable my checkboxes options as highlighted in the image.
And dialog.xml is like
<stewartOwned jcr:primaryType="cq:Widget"
defaultValue="false" fieldLabel="Stewart Owned"
inputValue="false" name="./stewartOwned" type="checkbox"
xtype="selection" layout="hbox">
<options jcr:primaryType="cq:WidgetCollection">
<option1 jcr:primaryType="nt:unstructured" text=""
value="stewartOwned" />
<option2 jcr:primaryType="nt:unstructured" text=""
value="ShowInAdvanced" />
</options>
<optionsConfig jcr:primaryType="nt:unstructured"
width="150" />
</stewartOwned>
<independent jcr:primaryType="cq:Widget"
defaultValue="false" fieldLabel="Independent" inputValue="false"
name="./independent" type="checkbox" xtype="selection"
layout="hbox">
<options jcr:primaryType="cq:WidgetCollection">
<option1 jcr:primaryType="nt:unstructured" text=""
value="I" />
<option2 jcr:primaryType="nt:unstructured" text=""
value="ShowInAdvanced" />
</options>
<optionsConfig jcr:primaryType="nt:unstructured"
width="150" />
</independent>
I have tried following solution to disable through id but it is not viable as id is auto generate and you never know what id will be generated in the next session.
listeners jcr:primaryType="nt:unstructured"
loadcontent="function(dialog) {
CQ.Ext.getDom('ext-comp-1568').disabled = 'disabled';
CQ.Ext.getDom('ext-comp-1573').disabled = 'disabled';
}" />
Can someone please suggest how I disable highlighted checkboxes in dialog.xml ?
After a lot of research and reading CQ5 documentation, I managed to find out following solution.
var nameField =
dialog.getField('./name').getEl().child('input[value*=ShowInAdvanced]').id;
CQ.Ext.getDom(nameField).disabled = 'disabled';

how to have 4 columns in a row simpleform SAPUI5

I need to align columns in <form:SimpleForm>. I need 4 columns in a row but only 2 columns are aligned. Here is my example, Please refer JsBin
Needed output :
label input-field label input-field
current output :
label input-field
label input-field
To use a new container on the right, simply set an empty title.
But be aware tabbing won't be from left to right, top to bottom but (per container) top to bottom, left to right
After all, it just a SimpleForm ;-)
See this working example (please run the example full-page, otherwise it will still show the fields top-town because of the responsive nature):
sap.ui.controller("view1.initial", {
onInit : function() { }
});
sap.ui.xmlview("main", {
viewContent: jQuery("#view1").html()
})
.placeAt("uiArea");
<script id="sap-ui-bootstrap"
src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-xx-bindingSyntax="complex"
data-sap-ui-libs="sap.m"></script>
<div id="uiArea"></div>
<script id="view1" type="ui5/xmlview">
<mvc:View
controllerName="view1.initial"
xmlns="sap.m"
xmlns:l="sap.ui.layout"
xmlns:f="sap.ui.layout.form"
xmlns:core="sap.ui.core"
xmlns:mvc="sap.ui.core.mvc">
<f:SimpleForm
maxContainerCols="2"
editable="true"
layout="ResponsiveGridLayout"
labelSpanL="4"
labelSpanM="4"
emptySpanL="0"
emptySpanM="0"
columnsL="2"
columnsM="2">
<f:content>
<core:Title text="A Title" />
<Label text="1st label" required="true" />
<Input value="Blah" />
<core:Title text="" /> <!-- empty title so it looks like this container belongs to the left one -->
<Label text="2nd label" required="true" />
<Input value="Blah" />
</f:content>
</f:SimpleForm>
</mvc:View>
</script>

AEM/CQ Multiple Image Component

I'm trying to create a component with two images and some information, i have created the dialog, managed to create the nodes and upload the image. Everything works fine but i can't find a way to get the image's path or render it.
This is what i have so far:
<%# page import="com.day.text.Text,
com.day.cq.wcm.foundation.Image,
com.day.cq.commons.Doctype" %>
<%#include file="/apps/platform/aem-core/global/global.jsp"%>
<%
Image image = new Image(resource, "image1");
out.println(image);
image.draw(out);
%>
<h2><%=image.getSrc()%></h2>
This gives me: /content/region-growth/brazil/brazil-poc/pt-br/home/jcr:content/leadmachine-new/image1/file.jpg/1456255696906.jpg and if i go to this folder there is a node called image1 > file. The image is there, if i try to download it using crxde i can open it so i believe my problem is with the path.
This is the dialog XML:
<dialog jcr:primaryType="cq:Dialog"
title="Lead Machine"
xtype="dialog">
<items jcr:primaryType="cq:TabPanel">
<items jcr:primaryType="cq:WidgetCollection">
<generalTab jcr:primaryType="cq:Panel"
title="Geral">
<items jcr:primaryType="cq:WidgetCollection">
<campanhaID jcr:primaryType="nt:unstructured"
allowBlank="false"
fieldLabel="Campanha ID"
name="./jcr:campanhaid"
xtype="textfield" />
<titulo jcr:primaryType="nt:unstructured"
allowBlank="false"
fieldLabel="Título"
name="./jcr:titulo"
xtype="textfield" />
<corFundo jcr:primaryType="nt:unstructured"
allowBlank="false"
fieldLabel="Cor de Fundo"
name="./jcr:corfundo"
xtype="colormenu" />
<corBotao jcr:primaryType="nt:unstructured"
allowBlank="false"
fieldLabel="Cor do Botão"
name="./jcr:corbotao"
xtype="colormenu" />
<txtBotao jcr:primaryType="nt:unstructured"
allowBlank="false"
fieldLabel="Texto do Botão"
ame="./jcr:txtBotao"
xtype="textfield" />
<texto jcr:primaryType="nt:unstructured"
allowBlank="true"
fieldLabel="Texto"
name="./jcr:texto"
xtype="richtext" />
<observacao jcr:primaryType="nt:unstructured"
allowBlank="true"
fieldLabel="Observação"
name="./jcr:observacao"
xtype="richtext" />
<layoutForm jcr:primaryType="cq:Widget"
fieldDescription="LM com formato simples"
fieldLabel="Layout Form"
inputValue="true"
name="./layoutForm"
type="checkbox"
xtype="selection" />
<agendamento jcr:primaryType="cq:Widget"
fieldDescription="LM com agendamento"
fieldLabel="Agendamento"
inputValue="true"
name="./agendamento"
type="checkbox"
xtype="selection" />
<ativo jcr:primaryType="cq:Widget"
fieldLabel="Ativo"
inputValue="true"
name="./ativo"
type="checkbox"
xtype="selection" />
</items>
</generalTab>
<tab1 jcr:primaryType="cq:Panel" title="Image Properties">
<image1ResType jcr:primaryType="cq:Widget" ignoreData="{Boolean}true" name="./image1/sling:resourceType" value="foundation/components/image" xtype="hidden"/>
<image2ResType jcr:primaryType="cq:Widget" ignoreData="{Boolean}true" name="./image2/sling:resourceType" value="foundation/components/image" xtype="hidden"/>
</tab1>
<tab2 jcr:primaryType="cq:Widget"
cropParameter="./imageCrop"
fileNameParameter="./fileName"
fileReferenceParameter="./fileReference"
mapParameter="./imageMap"
name="./file"
requestSuffix="/img.jpg"
rotateParameter="./imageRotate"
title="Image 1"
xtype="html5smartimage" />
<tab3 jcr:primaryType="cq:Widget"
cropParameter="./mdImageCrop"
fileNameParameter="./mdFileName"
fileReferenceParameter="./mdFileReference"
mapParameter="./mdImageMap"
name="./mdFile"
requestSuffix="/mdImage.img.jpg"
rotateParameter="./mdImageRotate"
title="Image 2"
xtype="html5smartimage" />
</items>
</items>
</dialog>
Node childNode = currentNode.getNode("file");
if (childNode != null) {
if (childNode.hasProperty("fileReferenceParameter")) {
return childNode.getProperty("fileReferenceParameter").getString();
}
}
And why do you use hidden imageResType in tab1?
Also you may use the following using image object:
<%
Image image = new Image(resource, "file");
%>
<img src='<%=image.getSrc()'/>

Componentart tabstrip only rendering first tab

I have a ComponentArt tabstrip. Our firm recently migrated all it's users to IE8. For some reason on some pages the tabstrip only display the first tab now. But on others it renders fine. The code for the tabstrip is virtually identical in all pages, saving things like tab names. Here's an example from a page that only renders the first tab:
<ComponentArt:TabStrip ID="tsAdmin" runat="server" MultiPageId="EditUsers" CssClass="TopTabs"
DefaultItemLookId="DefaultTabLook"
DefaultSelectedItemLookId="SelectedTabLook"
DefaultDisabledItemLookId="DisabledTabLook"
DefaultGroupTabSpacing="1"
ImagesBaseUrl="tabstrip"
ScrollingEnabled="false"
ScrollLeftLookId="ScrollItem"
ScrollRightLookId="ScrollItem"
Width="100%" >
<Tabs>
<ComponentArt:TabStripTab runat="server" ID="tab0" Text="Tab 1"></ComponentArt:TabStripTab>
<ComponentArt:TabStripTab runat="server" ID="tab1" Text="Tab 2"></ComponentArt:TabStripTab>
<ComponentArt:TabStripTab runat="server" ID="tab2" Text="Tab 3"></ComponentArt:TabStripTab>
<ComponentArt:TabStripTab runat="server" ID="tab3" Text="Tab 4"></ComponentArt:TabStripTab>
</Tabs>
<ItemLooks>
<ComponentArt:ItemLook LookId="DefaultTabLook" CssClass="DefaultTab" HoverCssClass="DefaultTabHover" LabelPaddingLeft="10" LabelPaddingRight="10" LabelPaddingTop="5" LabelPaddingBottom="4" LeftIconUrl="tab_left_icon.gif" RightIconUrl="tab_right_icon.gif" HoverLeftIconUrl="hover_tab_left_icon.gif" HoverRightIconUrl="hover_tab_right_icon.gif" LeftIconWidth="3" LeftIconHeight="21" RightIconWidth="3" RightIconHeight="21" />
<ComponentArt:ItemLook LookId="SelectedTabLook" CssClass="SelectedTab" LabelPaddingLeft="10" LabelPaddingRight="10" LabelPaddingTop="4" LabelPaddingBottom="4" LeftIconUrl="selected_tab_left_icon.gif" RightIconUrl="selected_tab_right_icon.gif" LeftIconWidth="3" LeftIconHeight="21" RightIconWidth="3" RightIconHeight="21" />
<ComponentArt:ItemLook LookId="ScrollItem" CssClass="ScrollItem" HoverCssClass="ScrollItemHover" LabelPaddingLeft="5" LabelPaddingRight="5" LabelPaddingTop="0" LabelPaddingBottom="0" />
</ItemLooks>
</ComponentArt:TabStrip>
When I check the page source there are some generated javascript references to the various tabs, but when I check the source code with Firebug only the first tab has any markup references in the HTML. On the pages where the tabs render properly, all tabs are visible in the HTML through Firebug.
I'm not sure how to delete this question. Turns out the problem was with some javascript I'd written and not the tab strip.

Button action called upon second click

I have 2 command buttons and one select one menu. I need to call a bean method depending on the buttons selected and the currently selected item in the menu.
<h:form id="form1">
<h:outputLabel value="menu:" />
<h:commandButton value ="en" action="#{bean.exec}" >
<f:setPropertyActionListener target="#{bean.menu}" value='en' />
</h:commandButton>
<h:commandButton value ="fr" action="#{bean.exec}" >
<f:setPropertyActionListener target="#{bean.menu}" value='fr' />
</h:commandButton>
<h:outputLabel value="id:" />
<h:selectOneMenu value="#{bean.id}">
<f:selectItems value="#{bean.idlist}" />
<f:ajax listener="#{bean.exec}" render ="form1" />
</h:selectOneMenu>
</h:form>
However, although the first button updates my properties and calls the action method, the second button gives me the following message
WARNING: FacesMessage(s) have been enqueued, but may not have been displayed
and the view doesn't get updated on the fist click. However, immediately on the second click, the properties get updated and so does the view.
How is this caused and how can I solve it?
I did see the log, however I dont understand the error: this is what it shows: form1:j_idt124: Validation Error: Value is not valid What value and where?
It's easier to identify the value if you give all input components an ID and attach a <h:message> to them as follows:
<h:outputLabel for="id" value="id:" />
<h:selectOneMenu id="id" value="#{bean.id}">
<f:selectItems value="#{bean.idlist}" />
<f:ajax listener="#{bean.exec}" render ="form1" />
</h:selectOneMenu>
<h:message for="id" />
This way you will get form1:id as label instead of form1:j_idt124. Alternatively, you can also specify the label of the input component:
<h:selectOneMenu label="id" ... />
As to the "Value is not valid" error, you will get this error when the selected value does not match any one of the available values during processing the form submit. This can in turn happen when the property behind #{bean.idlist} has incompatibly changed during processing the form submit. This can in turn happen when the bean is request scoped. Putting the bean in the view scope should fix it.
See also:
Validation Error: Value is not valid

Resources