I have paid a decent hair tribute to this one
Why in the world, Label 1 and Label 2 have different vertical alignments?
<s:Form width="100%">
<s:FormHeading width="100%" label="Heading" />
<s:FormItem width="100%" label="Label 1">
<s:HGroup verticalAlign="bottom">
<s:Label text="Size" fontSize="40"/>
<s:Label text="Mb"/>
</s:HGroup>
</s:FormItem>
<s:FormItem width="100%" label="Label 2">
<s:HGroup verticalAlign="middle">
<s:VGroup horizontalAlign="center">
<s:Label text="Set1" />
<s:Label text="{this.set1}" fontSize="40"/>
<s:Label text="Days" />
</s:VGroup>
<s:Label text="+" fontSize="40" />
<s:VGroup horizontalAlign="center">
<s:Label text="Set2" />
<s:Label text="{this.set2}" fontSize="40" />
<s:Label text="Days" />
</s:VGroup>
</s:HGroup>
</s:FormItem>
</s:Form>
Bug or feature? The label of a FormItem is aligned with the baseline of the FormItem's content. A picture says more than a thousand words, so I'll show you what happens:
So it turns out to be a feature (thanks for asking this question: I didn't know this myself until today).
In order to "fix" this feature, you'll have to create a custom skin: create a skin class by copying the original spark.skins.spark.FormItemSkin.
Find the element called labelDisplay; it should look like this:
<s:Label id="labelDisplay"
fontWeight="bold"
left="labelCol:0" right="labelCol:5"
bottom="row1:10" baseline="row1:0"/>
See that baseline attribute? That's what's causing the undesired behaviour.
You can simply remove it; the label will then always align to the bottom. If you wish to align it to the vertical center, you could alter it like this:
<s:Label id="labelDisplay" fontWeight="bold" verticalAlign="middle"
left="labelCol:0" right="labelCol:5" top="row1:10" bottom="row1:10"/>
Now all you need to do, is applying your custom skin to your FormItem:
<s:FormItem skinClass="my.custom.FormItemSkin">
Or in case of more frequent usage:
<fx:Style>
#namespace s "library://ns.adobe.com/flex/spark";
s|FormItem.centeredLabel {
skinClass: ClassReference("my.custom.FormItemSkin");
}
</fx:Style>
<s:FormItem styleName="centeredLabel">
Related
enableTickmarksis true for both slider controls, yet only one shows them?
<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core">
<Dialog title="{Title}" icon="sap-icon://create">
<beginButton>
<Button text="{i18n>cancel}" press="handleCloseCompetencySelection"/>
</beginButton>
<endButton>
<Button type="Accept" text="{i18n>submit}" press="handleSubmitCompetencySelection"/>
</endButton>
<content>
<FlexBox direction="Column" alignItems="Center" class="sapUiMediumMarginTopBottom">
<items>
<HBox><Label text="{i18n>required}: "/><Label id="RequiredProficiencyLabel" text="{ProfidrDescr}" design="Bold"/></HBox>
<Slider id="RequiredProficiencySlider" enabled="false" liveChange="onSliderChange" enableTickmarks="true" min="0" max="10"
class="sapUiSmallMarginBottom" width="400px"/>
</items>
</FlexBox>
<FlexBox direction="Column" alignItems="Center" class="sapUiMediumMarginTopBottom">
<items>
<HBox><Label text="{i18n>achieved}: "/><Label id="ProficiencyLabel" text="" design="Bold"/></HBox>
<Slider id="ProficiencySlider" liveChange="onSliderChange" enableTickmarks="true" min="0" max="10" class="sapUiSmallMarginBottom"
width="400px"/>
</items>
</FlexBox>
<MessageStrip text="{i18n>dragMessage}" type="Information" showIcon="true" class="sapUiMediumMargin"></MessageStrip>
</content>
</Dialog>
</core:FragmentDefinition>
There was a bug which is fixed as of version 1.52. The z-index of tickmarks was incorrectly set. Here you can see that the tickmarks are displayed correctly in Dialog: https://jsbin.com/ruqosej/edit?html,js,output
Funny story:
for "disabled" slider that tickmark looks bolder and perceptible than "enabled" one
the second slider shows the tickmarks, but you are not able to see them due to the very light grayscale color of the marks (to make sure that it is true, try to look at the sceen with different angle and you will see the tickmarks of the second slider; or use another display)
In fiori guideline of View Setting and Responsive Table, there is a info bar shows the filter setting. How to implement it?
It looks like a sap.m.MessageStrip, but there are only five kinds of MessageType in MessageStrip(Error, Information...), seems no such color suits for this bar. Should I overwrite this color?
In this Demo, message strip is put above the Table, but in design, it seems to put between table title and column, how to implement it?
I've tried this:
<Table>
<headerToolbar>
<Toolbar>
<Title id="tableHeader" text="title"/>
<!--BUTTONS-->
<VBox>
<MessageStrip
text="Filtered By:"
type="Information"
showCloseButton="true"
showIcon="false">
</MessageStrip>
</VBox>
</Toolbar>
</headerToolbar>
</Table>
But it looks like this:
It is called infoToolbar, not infoBar...
<Table>
<infoToolbar>
<Toolbar
active="true"
press="handleInfobarPress" >
<Label text="Filtered By: " />
<ToolbarSpacer />
<core:Icon
tooltip="Reset filter"
src="sap-icon://sys-cancel"
class="size2"
color="white"
press="onResetFilters">
</core:Icon>
</Toolbar>
</infoToolbar>
<headerToolbar>
<Toolbar>
<Title id="tableHeader" text="title"/>
<!--BUTTONS-->
</Toolbar>
</headerToolbar>
</Table>
infoToolbar is implemented in sap.m.ListBase as Aggregations: https://openui5.hana.ondemand.com/#/api/sap.m.ListBase
Both sap.m.List and sap.m.Table borrowed these aggregations/methods from sap.m.ListBase.
I am looking to add views (or workflow) to a roadmap steps in sapui5. I am new to sapui5, can any one help me out with this?
My code:
<script>
//create the RoadMap control
var oRMap = new sap.ui.commons.RoadMap("rMap");
//create the RoadMap steps
var oStep1 = new sap.ui.commons.RoadMapStep("step1", {label: "Step 1"});
var oStep2 = new sap.ui.commons.RoadMapStep("step2", {label: "Step 2"});
var oStep3 = new sap.ui.commons.RoadMapStep("step3", {label: "Step 3"});
//add steps to the RoadMap
oRMap.addStep(oStep1);
oRMap.addStep(oStep2);
oRMap.addStep(oStep3);
//Set the first step as selected
oRMap.setSelectedStep("step1");
//Set the number of visible steps
oRMap.setNumberOfVisibleSteps(3);
//Place the control on the UI
oRMap.placeAt("sample1");
</script>
This will show three steps in my application. What I want is to add views to each of the steps.
Say I want to add a date picker for first step, table for second step and so on..
How can I do this?
You can achieve this in many ways. I would create a container below your roadmap, where you display different views, one for each step. You could use a NavContainer which handles the navigation
EDIT: it can be as simple as this (I used XMLView notation since I find these a far easier to write, but the same applies for JSViews of course):
<VBox>
<c:RoadMap id="roadMap">
<c:steps>
<c:RoadMapStep id="step1" label="Step 1" />
<c:RoadMapStep id="step2" label="Step 2" />
<c:RoadMapStep id="step3" label="Step 3" />
</c:steps>
</c:RoadMap>
<NavContainer width="100%" height="20rem">
<Page title="Step 1">
<DatePicker />
<Button icon="sap-icon://feeder-arrow" text="Next step" press="doNext" />
</Page>
<Page title="Step 2">
<Text text="Some data"/>
<Button icon="sap-icon://nav-back" text="Previous step" press="doPrevious" />
<Button icon="sap-icon://feeder-arrow" text="Next step" press="doNext" />
</Page>
<Page title="Step 3">
<Text text="Some more data"/>
<Button icon="sap-icon://nav-back" text="Previous step" press="doPrevious" />
<Button icon="sap-icon://feeder-arrow" text="Next step" press="doNext" />
</Page>
</NavContainer>
</VBox>
In the doNext and doPrevious you then increment/decrement the roadmap's selectedStep property with the correct step ID, and you perform a nav.to(target) or nav.back()
See https://sapui5.hana.ondemand.com/sdk/explored.html#/sample/sap.m.sample.NavContainer/preview for info in the NavContainer
I'm currently trying to use the numbervalidator to validate that a couple of my fields that are using decimal values. I'd like it appear how the mx examples show e.g. http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/validators/NumberValidator.html#includeExamplesSummary
Even though I've enabled it (read below), the errorTip is not appearing. And the error message it does show is placed at the top of the screen rather than within the formitem.
<s:NumberValidator id="nv1" allowNegative="false" source="{field1}" property="text" fractionalDigits="3" />
<s:NumberValidator id="nv2" allowNegative="false" source="{field2}" property="text" fractionalDigits="3" />
I read a suggestion to override the formitem skin and set showErrorTip to true (on the contentGroup) but that had no impact. I also removed errorTextDisplay to try and stop the other error message appearing however that also had no impact.
I'd be happy enough if I could get the existing error messages to appear within the formItem (underneath). I've included the basic structure of my view below:
<s:Scroller width="100%" height="100%">
<s:Group>
<s:Form id="myForm" width="100%">
<s:layout>
<s:FormLayout gap="0"/>
</s:layout>
<s:HGroup width="100%">
<s:FormItem label="Field1" width="50%">
<s:TextInput id="field1" width="100%" text="{data.field1}" restrict="0-9." />
</s:FormItem>
<s:FormItem label="Field2" width="50%">
<s:TextInput id="field2" width="100%" text="{data.field2}" restrict="0-9." />
</s:FormItem>
</s:HGroup>
</s:Form>
</s:Group>
</s:Scroller>
It's a very long form (I've left out the other fields) which is why I've used a scroller and I'm showing the inputs in a two column layout.
Try this out, This should do the trick of showing the error message, U need to add a trigger to the validator and mention what event it has to trigger upon.
<?xml version="1.0" encoding="utf-8"?>
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Declarations>
<s:NumberValidator id="nv1" allowNegative="false" source="{field1}" property="text" fractionalDigits="3"
trigger="{validate}" triggerEvent="click" requiredFieldError="No use"/>
<s:NumberValidator id="nv2" allowNegative="false" source="{field2}" property="text" fractionalDigits="3"
trigger="{validate}" triggerEvent="click" requiredFieldError="No use"/>
</fx:Declarations>
<s:Scroller width="100%" height="100%">
<s:Group>
<s:Form id="myForm" width="100%">
<s:layout>
<s:FormLayout gap="0"/>
</s:layout>
<s:VGroup width="100%">
<s:FormItem label="Field1" width="50%">
<s:TextInput id="field1" width="100%" text="11" restrict="0-9." />
</s:FormItem>
<s:FormItem label="Field2" width="50%">
<s:TextInput id="field2" width="100%" text="22" restrict="0-9." />
</s:FormItem>
</s:VGroup>
<s:Button id="validate" label="Validate"/>
</s:Form>
</s:Group>
</s:Scroller>
</s:Application>
The reason why you were getting differnent type of error with an icon is because you have used <s:Form> and <s:FormItem>, While changing it to <mx:Form> and <mx:FormItem> you will get the old kind of error with the highlighted box and error on tool tip. Try the below sample.
<?xml version="1.0" encoding="utf-8"?>
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Declarations>
<s:NumberValidator id="nv1" allowNegative="false" source="{field1}" property="text" fractionalDigits="3" />
<s:NumberValidator id="nv2" allowNegative="false" source="{field2}" property="text" fractionalDigits="3" />
</fx:Declarations>
<s:Scroller width="100%" height="100%">
<s:Group>
<mx:Form id="myForm" width="100%">
<s:HGroup width="100%">
<mx:FormItem label="Field1" width="50%">
<s:TextInput id="field1" width="100%" text="1" restrict="0-9." />
</mx:FormItem>
<mx:FormItem label="Field2" width="50%">
<s:TextInput id="field2" width="100%" text="2" restrict="0-9." />
</mx:FormItem>
</s:HGroup>
</mx:Form>
</s:Group>
</s:Scroller>
</s:Application>
I've managed to find the solution to my own question, partially because I neglected to mention what turned out to be an important part of the problem. The default layout of the form skins were pretty terrible so I had switched to the StackedFormSkin and StackedFormItemSkin respectively.
However the Stacked skins move the errorTextDisplay from the formitem to the form skin. What I ended up needing to do was create my own skins (c+p'd from the respective stacked skins).
In my form skins I simply removed the errorTextDisplay element from the FormSkin and copied errorTextDisplay from the original FormItemSkin, made a few alterations (as below) to make it appear underneath the text input.
<s:RichText id="errorTextDisplay" includeIn="errorStates"
fontStyle="italic" fontWeight="normal" color="0xFE0000"
left="contentCol:0" right="helpCol:10"
bottom="row3:10" baseline="row3:0"
maxDisplayedLines="-1"/>
You'll need to add row3 as an extra ConstraintRow.
Basically the change above will get the advantages of the StackedForm skins but means that you're error messages will still appear alongside the input which caused the error.
Bllow is my AspxGridview syntax
<dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" KeyFieldName="Menu_ID"
OnCellEditorInitialize="ASPxGridView1_CellEditorInitialize" OnCustomUnboundColumnData="ASPxGridView1_CustomUnboundColumnData">
<Columns>
<dx:GridViewCommandColumn VisibleIndex="0">
<EditButton Visible="True">
</EditButton>
<NewButton Visible="True">
</NewButton>
<DeleteButton Visible="True">
</DeleteButton>
<CustomButtons>
<dx:GridViewCommandColumnCustomButton Text="Create a Copy" ID="Copy" />
</CustomButtons>
</dx:GridViewCommandColumn>
<dx:GridViewDataTextColumn Caption="Module_ID" FieldName="Module_ID" UnboundType="Integer"
VisibleIndex="1">
</dx:GridViewDataTextColumn>
<dx:GridViewDataButtonEditColumn Caption="Target_URL" FieldName="Target_URL" UnboundType="String"
VisibleIndex="2">
<PropertiesButtonEdit>
<Buttons>
<dx:EditButton Text=".." Width="5px">
</dx:EditButton>
</Buttons>
</PropertiesButtonEdit>
</dx:GridViewDataButtonEditColumn>
<dx:GridViewDataTextColumn Caption="Menu_ID" FieldName="Menu_ID" UnboundType="Integer"
VisibleIndex="3">
</dx:GridViewDataTextColumn>
</Columns>
</dx:ASPxGridView>
AspxGridview edit/insert mode Click on Target_URL column button i want to FileUpload .
Please take a look at the following example posted in our site:
http://www.devexpress.com/Support/Center/CodeCentral/ViewExample.aspx?exampleId=E95