How do I bind a model propery to table row selector in SAPUI5? - binding

I'm using a Sap.M.Table, which should have a column of checkboxes bound to data. The Checkbox that shows up with MultiToggle selection seems to be a prettier solution all around, but how do I bind that particular checkbox (i.e. the 'row is selected' property) to my boolean property in my model?
I can't find any information about this seemingly simple thing anywhere.
My table is currently setup with a rows aggregation, and Column definitions that contain templates. I did try changing the rows aggregation to an items aggregation and then moved the content of my templates to the cells aggregation from the Items element in the xml, but as soon as I included the Items element, I got the 404 on sap.m.Items.js
<tab:Table
rows="{
path: '/Items'
}"
selectionMode="None"
visibleRowCountMode="Auto"
class="sapUiNoMargin"
>
<tab:columns>
<tab:Column width="4rem" sortProperty="StatusBool">
<Label text="Book" />
<tab:template>
<Checkbox selected="{Selected}" enabled="{StatusBool}" select="OnBookSelect" />
</tab:template>
</tab:Column>
<tab:Column width="6rem" sortProperty="ProdOrder">
<Label text="Production Order" />
<tab:template>
<Button text="{ProdOrder}" icon="sap-icon://inspection" width="100%" visible="{=!!${ProdOrder}}" press="OnProdOrderPress" />
</tab:template>
</tab:Column>
<tab:Column width="14rem" sortProperty="ItemCode">
<Label text="Item Code" />
<tab:template>
<Label text="{ItemCode}" />
</tab:template>
</tab:Column>
<tab:Column width="10rem" sortProperty="Op">
<Label text="Op" />
<tab:template>
<Label text="{Op}" />
</tab:template>
</tab:Column>
<tab:Column width="8rem" sortProperty="PlanQty">
<Label text="Planned Time" />
<tab:template>
<Label text="{PlanQty}" />
</tab:template>
</tab:Column>
</tab:Columns>
</tab:Table>

Related

typo3 double quotes in hash __trustedProperties 'The HMAC of the form could not be validated.'

thank you for your support.
I created a form with select options. The fields are filled with arrays provided with the settings variable.
The field in __trustedProperties quoted with the "-sign. This results in "{" as hash.
[__trustedProperties]" value="{"newRfichip":{"id":1,"status":1,"location":1,"personid":1}}2ec7e718db7f0844040e31baaa69a8452a650302" />
Normaly there should be & quot; instead the "-sign.
[__trustedProperties]" value="{& quot;newRfichip& quot;:{& quot;id& quot;:1,& quot;status& quot;:1,& quot;location& quot;:1,& quot;personid& quot;:1}}2ec7e718db7f0844040e31baaa69a8452a650302" />
I get always an exception 'The HMAC of the form could not be validated.'
I'm grateful for every hint, how i can solve this problem
FormFields.html
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<label for="id">
<f:translate key="tx_bbaorfichip_domain_model_rfichip.id" />
</label><br />
<f:form.textfield property="id" id="id" /><br />
<br\>
<f:debug>{_all}</f:debug>
<f:debug>{__trustedProperties}</f:debug>
<br\>
<label for="status">
<f:translate key="tx_bbaorfichip_domain_model_rfichip.status" />
</label><br />
<f:form.select property="status" id="status"
options="{settings.stati}"
value="4"
optionValueField="status"
optionLabelField="status" />
<br />
<label for="location">
<f:translate key="tx_bbaorfichip_domain_model_rfichip.location" />
</label><br />
<f:form.select property="location" id="location"
options="{settings.location}"
value="4"
optionValueField="location"
optionLabelField="location" />
<br />
<label for="personid">
<f:translate key="tx_bbaorfichip_domain_model_rfichip.personid" />
</label><br />
<f:form.select property="personid" id="personid"
options="{settings.personid}"
optionValueField="personid"
optionLabelField="personid" />
<br />
</html>

Is it possible to set a form variable to an array in gsp?

This is my current code:
<g:form method="post" >
<g:hiddenField name="id" value="${personInstance?.id}" />
<g:hiddenField name="version" value="${personInstance?.version}" />
<fieldset class="form">
<g:render template="form"/>
</fieldset>
<fieldset class="buttons">
<g:actionSubmit class="save" action="update" value="update', default: 'Update')}" />
<g:actionSubmit class="delete" action="delete" value="update", default: 'Delete')}" />
</fieldset>
</g:form>
In my person instance, I have a list variable that I want to set as a hidden field as well, but I am unable to figure out how to do so as the hiddenField tag can only take in one piece of text. This is what I want to create:
<g:hiddenField name="classes" value=["English", "Math"] />
Is this possible a different way?

Nested Header Implementation Using AbstractGroupsModel and List box(like Grid hierarchy demo))

I want to design Nested Header (for group header and data header related to group.)
Means I want to design like this . The top header will be there, once I will click on the header the sub header data will come (The sub header will contain one header and some record data.)
I have written the code like this
<template name="model:group" var="group">
<listgroup label="#load(groupNameList)"
style="color: #666;" open="false"
onClick="#command('groupCloseAndOpen',listGroup = self)"
tooltiptext="#load(each)">
<listcell>
<label value="${group.deptId}" tooltiptext="${each.deptId}">
</label>
</listcell>
<listcell>
<label value="${group.deptName}"
tooltiptext="${each.deptName}">
</label>
</listcell>
<listcell>
<label value="${group.deptLoc}"
tooltiptext="${each.deptLoc}">
</label>
</listcell>
</listgroup>
</template>
<template name="model" var="folderInfoData">
<listitem>
<listcell if="${folderInfoDataStatus.index == 0}">
<label
value="#load(folderInfoData.id)"/>
</listcell>
<listcell>
<label
value="#load(folderInfoData.id)"/>
</listcell>
<listcell><label
value="#load(folderInfoData.name)" />
</listcell>
<listcell><label
value="#load(folderInfoData.sal)"
/>
</listcell>
</listitem>
</template>
</listbox>
Can anyone suggest how to solve this issue ?

Unable to pass a variable parameter to jasper report

So, I have created a simple CRUD app using groovy on grails and I want to use jasper reporting plugin to get some simple reports on the database. I have set up a simple G:select to pick from a drop down list, and hitting the PDF icon I am bringing back a blank page. gsp is below
<div id="page-body" role="main">
<p>Please select one of the following options</p>
<div>
<g:select optionKey="id"
optionValue="artist"
name="artist"
id="MusicCatalogue"
value="${artist}"
from="${multicatalogue.MusicCatalogue.list()}">
</g:select>
</div>
<div> <g:jasperReport jasper="report1" format="PDF" name="Music Catalogue" />
<input type="hidden" name="artist" value="${artist}" />
</div>
</div>
and then the jrxml looks like the below
<parameter name="artist" isForPrompting="true" class="java.lang.String">
<defaultValueExpression><![CDATA["<parameter error>"]]></defaultValueExpression>
</parameter>
<queryString language="SQL">
<![CDATA[SELECT *
FROM
MusicCatalogue where ARTIST = $P{artist}]]>
</queryString>
<field name="ID" class="java.lang.Integer"/>
<field name="ALBUM" class="java.lang.String"/>
<field name="ARTIST" class="java.lang.String"/>
<field name="TRACK" class="java.lang.String"/>
<group name="ARTIST">
ideas????
Try replace
<g:jasperReport jasper="report1" format="PDF" name="Music Catalogue" />
<input type="hidden" name="artist" value="${artist}" />
With
<g:jasperReport jasper="report1" format="PDF" name="Music Catalogue">
<input type="hidden" name="artist" value="${artist}" />
</g:jasperReport>
Also, make sure that ${artist} returns a string value, else the report will use the defaultValue of artist parameter that might ruin your query.

Struts2: Hidden field and anchor tag <s:a> values In Action Class

I am working on a struts2 application. In my jsp page I have 2-3 anchor tag and 2-3 hidden fields like
<s:a href="#">File 1</s:a>
<s:a href="#">File 2</s:a>
<s:a href="#">File 3</s:a>
and
<s:hidden name=" hidden1" />
<s:hidden name=" hidden2" />
<s:hidden name=" hidden3" />
Now please let me know, In my action class how can I get value of all the hidden fields and anchor tag which was clicked.
I had tried following
<s:a href="#" action=”someAction”>File 1</s:a>
Its working but didn’t transfer value of hidden fileds.
Also
<s:a href="#" name=”File1” onclick=”submit”>File 1</s:a>
But no gain.
Looking for your reply.
Like Boris said, you need to put the hidden fields inside a form, and submit that form, OR you can add them as URL parameters to your links. The best method is probably using a form with POST so the hidden fields aren't on your browser's location bar.
Here's an example
<s:form id="myform" name="myform" action="someAction" method="POST">
<s:hidden name=" hidden1" value="first value"/>
<s:hidden name=" hidden2" value="second value"/>
<s:hidden name=" hidden3" value="third value"/>
Submit with link
<s:submit value="%{'Submit with button'}" />
</s:form>
Since this really has nothing to do with struts2, here's an example with pure HTML:
<form id="myform" name="myform" action="someAction.action" method="POST">
<input type="hidden" name=" hidden1" value="first value"/>
<input type="hidden" name=" hidden2" value="second value"/>
<input type="hidden" name=" hidden3" value="third value"/>
Submit with a link
<br/>
<input type="submit" value="Submit with a button"/>
</form>

Resources