Grid with five cells in SAP UI5 - sapui5

Is there a way to get 5 cell Grid per row using sap.ui.layout.Grid.
I am able to get 6 Cells when the span is 2,
4 cells when the span is 3 and
3 cells when the span is 4.
But cannot seem to get 5 cell row using this control. thoughts?

By default a Grid acts as a separation of the screen by 12 columns. The span indicates the size of each section you want to divide. In your example with a span of 2, the result is 6 Cells since 12/2 = 6.
Since you cannot specify a decimal size for the span, what you can do is play around with the indentation. If you choose a span of 2 like in your example but you use an indentation on the first element of 1, only 5 columns will appear since you won't have enough space for the sixth one (1 + 2 + 2 + 2 + 2 + 2 = 11 -> hence no space for a +2 column). A quick example that will allow you to see this in action is as such:
<mvc:View
xmlns:mvc="sap.ui.core.mvc"
xmlns:l="sap.ui.layout"
xmlns="sap.ui.commons"
controllerName="sap.ui.layout.sample.GridProperties.GridProperties"
xmlns:html="http://www.w3.org/1999/xhtml">
<l:VerticalLayout
width="100%">
<l:Grid defaultSpan="XL2 L2 M5 S12" position="Center">
<l:content>
<Label text="Text">
<layoutData>
<l:GridData span="XL2 L2" indent="XL1" />
</layoutData>
</Label>
<Label text="Text">
<layoutData>
<l:GridData span="XL2 L2"/>
</layoutData>
</Label>
<Label text="Text">
<layoutData>
<l:GridData span="XL2 L1" />
</layoutData>
</Label>
<Label text="Text">
<layoutData>
<l:GridData span="XL2 L2" />
</layoutData>
</Label>
<Label text="Text">
<layoutData>
<l:GridData span="XL2 L2" />
</layoutData>
</Label>
<Label text="Text">
<layoutData>
<l:GridData span="XL2 L2" />
</layoutData>
</Label>
</l:content>
</l:Grid>
</l:VerticalLayout>
</mvc:View>
If you remove the indent from the first label, you'll see the 6 labels in the same row, otherwise only 5 will appear.
Hope this helps!

Related

How to auto-wrap if total html or component properties >= n?

As I understand with the default settings in vscode. The properties below will only auto-wrap when it reaches to the maxiumum wordWrapColumn. (See below)
<h1 className="sample" height="20" width="30" color="20" size="200" />
// auto separated
<h1
className="sample"
height="20"
width="30"
color="blue"
size="200"
/>
I wanna ask if its possible to change this behavior? Instead of basing to wordWrapColumn, we check the total properties of an element / component.
We auto-newline when it reaches to the specified total props.
totalHtmlProps = 3
## case 1
<h1 className="sample" height="20" />
## case 2
<h1
className="sample"
height="20"
color="blue"
/>
a quick update: i'm also using prettier with this.

How to properly add a torsional_spring element to a RigidBodyTree in Drake

I am using the Drake simulator, and attempting to add joint stiffness to the Acrobot demo found in the underactuated robotics repo, and so far have been unable to successfully integrate such stiffness into the simulation.
I am running the script torque_slider_demo.py, which references the URDF file acrobot.urdf. I modified this URDF to include a torsional spring entry as follows:
<torsional_spring stiffness = "100000000" rest_angle = ".75">
<joint name = "shoulder"/>
</torsional_spring>
This element is added after defining joints (Full XML shown below), and I increased damping in both joints to more quickly see steady-state behavior.
<?xml version="1.0"?>
<robot xmlns="http://drake.mit.edu"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
name="Acrobot">
<link name="base_link">
<visual>
<geometry>
<box size="0.2 0.2 0.2" />
</geometry>
<material name="green">
<color rgba="0 1 0 1" />
</material>
</visual>
</link>
<link name="upper_link">
<inertial>
<origin xyz="0 0 -.5" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="1" ixy="0" ixz="0" iyy="0.083" iyz="0" izz="1" />
</inertial>
<visual>
<origin xyz="0 0 -0.5" rpy="0 0 0" />
<geometry>
<cylinder length="1.1" radius="0.05" />
</geometry>
<material name="red">
<color rgba="1 0 0 1" />
</material>
</visual>
</link>
<link name="lower_link">
<inertial>
<origin xyz="0 0 -1" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="1" ixy="0" ixz="0" iyy="0.33" iyz="0" izz="1" />
</inertial>
<visual>
<origin xyz="0 0 -1" rpy="0 0 0" />
<geometry>
<cylinder length="2.1" radius=".05" />
</geometry>
<material name="blue">
<color rgba="0 0 1 1" />
</material>
</visual>
</link>
<joint name="shoulder" type="continuous">
<parent link="base_link" />
<child link="upper_link" />
<origin xyz="0 0.15 0" />
<axis xyz="0 1 0" />
<dynamics damping="1" />
</joint>
<joint name="elbow" type="continuous">
<parent link="upper_link" />
<child link="lower_link" />
<origin xyz="0 0.1 -1" />
<axis xyz="0 1 0" />
<dynamics damping="1" />
</joint>
<torsional_spring stiffness = "100000000" rest_angle = ".75">
<joint name = "shoulder"/>
</torsional_spring>
<transmission type="SimpleTransmission" name="elbow_trans">
<actuator name="elbow" />
<joint name="elbow" />
<mechanicalReduction>1</mechanicalReduction>
</transmission>
</robot>
With this absurdly high stiffness value, I would expect for the arm to stabilize around the resting angle of the spring and exhibit an obvious pull towards the resting angle, however I do not see these effects in the visualization produced by the script.
Am I improperly defining the torsional spring in the URDF? Do I need to do some other setup to tell the simulator to consider joint stiffness?
It looks like we have support for torsional springs, but don't actually load them from URDF (nor expose the interface in python):
https://github.com/RobotLocomotion/drake/blob/master/attic/multibody/test/rigid_body_tree/rigid_body_tree_spring_test.cc
It would not be hard to add, and we'd welcome the contribution if you want to add the few lines to the parser. The drake developers are focused on multibodyplant now (which will replace rigidbodyplant).

ionic 2 ion-grid / ion-row / ion-col not working when used as a attribute to div

<ion-grid no-padding>
<ion-row>
<ion-col>col 1</ion-col>
<ion-col>col 2</ion-col>
<ion-col>col 3</ion-col>
</ion-row>
</ion-grid>
Above code works good, its respective styles are applied, but, below one doesn't work.
<div ion-grid>
<div ion-row>
<div ion-col>col 1 div</div>
<div ion-col>col 2 div</div>
</div>
</div>
When I tried to put it as attributes, styles are not applied for grid, I get something similar to
col 1 div
col 2 div
expected result: col 1 div col 2 div
What am I doing wrong?
ref: http://ionicframework.com/docs/v2/api/components/grid/Grid/#grid-size

can't set width for auxheader in zk

I have a grid in which I want to set the width for auxheader in .zul but it's not working. I am using zk framework.
<grid id="chartGrid" model="#bind(vm.chartGridModel)" mold="paging"
style="overflow:auto" width="100%" >
<auxhead hflex="2" >
<auxheader hflex="2" align="center" width="200px" label="Date" rowspan="3"/>
</auxhead>
<auxhead hflex="1" children="#bind(vm.legendsFB)" visible="#bind(vm.vFb)" >
<auxheader align="center" width="200px" colspan="1"></auxheader>
<template name="children">
<auxheader align="center" label="#bind(each)" colspan="#bind(
vm.viewType eq '0' ? 3 :2)" hflex="2"/>
</template>
</auxhead>
<columns visible="false"><!-- make it invisible -->
<column width="200px"/><!-- specify width here -->
<column width="150px"/>
<column width="50px"/>
<column width="50px"/>
</columns>
<template name="model">
<row>
<cell align="center" ><label value="#load(each.report_date)"></label>
</cell>
<cell align="center"><label value="#load(each.total_action)"></label>
</cell>
<cell align="center"><label value="#load(each.from_user_male)"></label>
</cell>
<cell align="center"><label value="#load(each.from_user_female)"></label>
</cell>
</row>
</template>
</grid>
You set width and colspan.
colspan="x" means you will take the witdh of x columns of your template.
Now you can remove the colspan and it should work, but remember when you set width in px,
Be sure that the total px are the same as the px of all your rows.
You can also do width = "20%", this would mean that you take 20% of your total size of px of the columns.
Its easier to calculate to 100% then your total px.
Greetz chill.

removing extra space from top and left when using formitems in flex

I want to remove the extra space/padding/gap from FormItem I,m using in form for a mobile project in flex 4.6
I have tried making gap and padding to 0 but there the form and it's fields are still have indent to the right and top ?
<s:FormItem label="Start Date" width="150">
<s:HGroup>
<s:TextInput id="startDate" width="90" editable="false"/>
<s:Button id="setStartDate" label="set" height="34" fontSize="10" click="setStartDate_clickHandler(event)"/>
</s:HGroup>
</s:FormItem>
<s:FormItem label="End Date" width="150">
<s:HGroup>
<s:TextInput id="endDate" width="90" editable="false"/>
<s:Button id="setEndDate" label="set" height="34" fontSize="10" click="setEndDate_clickHandler(event)"/>
</s:HGroup>
</s:FormItem>
</s:HGroup>
</s:Form>
Gap between two form items, verticalGap.(set it on Form container)
Default hgroup gap is 6, set it to 0.
If gap between two items withn the FormItem, verticalGap (set this on the form container)
Form has FormHeading, set paddingTop=0 on this FormHeading comp. Also, try to set the height of this to 0 and PaddingTop = 0 on the form to reduce the gap btwn the first element and the top of the Form container.
This has good information about it http://livedocs.adobe.com/flex/3/html/help.html?content=layouts_08.html