not able get the rows in the grid zk java - zk

I have following code where I am adding the row to the group.
When I trying to fetch the rows by using grid.getRows.getChildren() is giving me the empty rows.
<template name="model">
<zk if="${forEachStatus.index == 0}">
<group label="refund" />
</zk>
<row if ="${forEachStatus.index != 0}">
<cell>
<inbox value="${forEachStatus.index}" />
</cell>
<cell>
<input value="${each}" />
</cell>
</row>
How we retrieve from the template.

Related

How to handle selectedItem on hirarchy grid ZK

I got a problem with hirarchy grid, i am following this zk live demo,so i am using grid for header data and listbox for detail data, but when i am using the selectedItem property in listbox detail the second row detail become selected too,Here is my UI design
This is my code i am using mvvm
<grid model="#load(vm.headers )">
<columns>
<column width="40px" />
<column label="Nomor Part" sort="auto(name)" style="color:black"/>
<column label="Description" sort="auto(averageHigh)" align="center" style="color:black"/>
<column label="Hotline" sort="auto(averageVolume)" align="center" style="color:black"/>
</columns>
<template name="model" var="item" >
<row>
<custom-attributes details="${item.details}" hotline="${item.hotline}" partNumber="${item.partNumber}"/>
<detail open="false" fulfill="onOpen">
<!--<include src="/widgets/grid/hierarchy/season.zul" details="${details}" hotline="${item.hotline}"/>-->
<include src="/widgets/grid/hierarchy/season.zul" details="#bind(item.details)" hotline="#bind(item.hotline)" partNumber="#bind(item.partNumber)"/>
</detail>
<label value="${item.partNumber}" />
<label value="${item.partDescription}"/>
<checkbox checked="#bind(item.hotline)" onCheck="#command('checkHotline',hotline=item.hotline)"></checkbox>
</row>
</template>
</grid>
And here is my list detail code :
<vbox>
<listbox width="100%" height="300px" model="#load(details)" mold="paging" pageSize="5"
emptyMessage="no data found" >
<listhead style = "text-align: center">
<listheader label="Kode Dealer"/>
<listheader label="Nama Dealer"/>
<listheader label="Alamat"/>
<listheader label="Jarak"/>
<listheader label="Aksi"/>
</listhead>
<template name="model" var="dtl">
<listitem style = "text-align: center" >
<listcell label="#bind(dtl.dealerCode)"/>
<listcell label="#bind(dtl.dealerName)"/>
<listcell label="#bind(dtl.address)"/>
<listcell label="#bind(dtl.distance)"/>
<listcell>
<checkbox checked="#bind(dtl.selectedDealer)" oncheck="#command('onSelectDealer',partNumber)" visible="#load(not hotline)"/>
</listcell>
</listitem>
</template>
</listbox>
<div align="right">
<button label="Cancel" onClick="#command('onSelectDealer',partNumber=partNumber)"/>
</div>
</vbox>
It's hard to provide advice without seeing your code. I would pay careful attention to the row expander code (from the demo)
<!-- use custom-attributes to store quarters and stock in row,
so it can be accessed later when detail onOpen -->
<custom-attributes quarters="${each.quarters}" stock="${each}" />
<detail open="false" fulfill="onOpen">
<include src="/widgets/grid/hierarchy/season.zul"
stock="${stock}" quarters="${quarters}" />
</detail>

Copy content to new content by using button

I'm using SAPUI5 XML view
myView.view.xml
<f:SimpleForm id="form1"/>
<f:content id="content1">
<core:Title text="" />
<m:Label text="Label A" />
<m:Input value="10/5/2548" enabled="false" />
<m:Label text="ชั้นที่/ปีที่" />
<m:Input value="1" />
<core:Title text="" />
<m:Label text="Label B" />
<m:Input value="3.25" />
<core:Title text="" />
</f:content>
</f:SimpleForm>
myController.controller.js
addNewContent:function(){
var content = this.getView().byId("form1").getContent();
this.getView().byId("form1").addContent(content);
}
Error message
not valid for aggregation "content" of Element
sap.ui.layout.form.SimpleForm#__xmlview1--form1
I want to copy content (id="content1") to button when click addNewContent Button
Anyone help thanks
Add more information
this is what i want to do
Technically
The getContent() method returns an array sap.ui.core.Element[].
The addContent() method takes a single sap.ui.core.Element as parameter.
So you need to do something like this:
this.getView().byId("form1").addContent(content[0]);
or this:
oForm = this.getView().byId("form1");
content.forEach(oControl => oForm.addContent(oControl))
or if not using ES6:
oForm = this.getView().byId("form1");
for (var i = 0; i < content.length; i++) {
oForm.addContent(content[i]);
}
Functionally
It is not clear to me what you are trying to achieve. Based on your code snippet, you are trying to copy from and paste to the same place...
Hope this will help you, try to clone form and append it to the container.
XML view
<Button text="+" press="cloneContent" /><!-- Button for cloning -->
<f:SimpleForm id="form1" editable="false" layout="ResponsiveGridLayout" title="Address" labelSpanXL="3" labelSpanL="3" labelSpanM="3" labelSpanS="12" adjustLabelSpan="false" emptySpanXL="4" emptySpanL="4" emptySpanM="4" emptySpanS="0" columnsXL="1" columnsL="1" columnsM="1" singleContainerFullSize="false">
<f:content>
<core:Title text="" />
<Label text="Label A" />
<Input value="10/5/2548" enabled="false" />
<Label text="ชั้นที่/ปีที่" />
<Input value="1" />
<core:Title text="" />
<Label text="Label B" />
<Input value="3.25" />
<core:Title text="" />
</f:content>
</f:SimpleForm>
<VBox id="contentHolder"></VBox><!-- clone form holder -->
Controller
cloneContent: function(oEvent){
var oForm = this.getView().byId("form1");
if (oForm) {
oFormClone = oForm.clone();
oFormClone.setTitle("");
var oHolder = this.getView().byId("contentHolder");
if (oHolder) {
//oHolder.removeAllItems();//if you want to remove all the previous added item you can uncomment this line
oHolder.addItem(oFormClone);
}
}
}
Note: Take care of binding after clone. You can use oHolder to rebind if you have any issue.

Listbox item remain selected

I have a bandbox with a Listbox inside.
My Listbox has "onSelect" listener, and inside this i do a myListbox.clearSelection()
after read the value of the selected item and write it on a TextBox.
The problem is, that when I open the bandpopup another time, the selected item in the List remain selected and Marked in blue color, and i can't select the same element twice because it's remain selected.
For example:
Open the Bandpopup.
Clik in a element, the value is written on the Textbox, and then learSelection()" is called.
The user clear the Textbox.
Reopen the Bandpopup.
Click on the same item in the ListBox.
Nothing occurs, because this element remains selected.
The Zul code:
<?page title="Enviar a" contentType="text/html;charset=UTF-8"?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="./envioWindow" ?>
<zk>
<window title="Enviar a" border="normal" width="60%" id="envioWindow"
apply="..............">
<bandbox id="sectorReparticionBusquedaSADE" >
<bandpopup apply="XXXXXX.FindSectorReparticionesBusquedaSADEBandboxComposer"
id="sectorReparticionesComboBusquedaSADE" width="650px">
<groupbox mold="3d">
<vbox>
<hbox>
<textbox id="textoSectorReparticionBusquedaSADE" />
</hbox>
<paging id="pagingSectorReparticionesDocsSADE" pageSize="10" />
<listbox mold="paging"
width="600px" id="sectoresReparticionesBusquedaSADEListbox"
model="#{listaSectorReparticionSADESeleccionada}"
selectedItem="#{sectorReparticionSeleccionada}"
paginal="${pagingSectorReparticionesDocsSADE}">
<listhead>
<listheader label="Código" width="30%" />
<listheader label="Nombre" height="70%" />
</listhead>
<listitem self="#{each=reparticion}">
<listcell label="#{reparticion.codigo}" />
<listcell label="#{reparticion.nombre}" />
</listitem>
</listbox>
</vbox>
</groupbox>
</bandpopup>
</bandbox>
<bandbox id="sectorBusquedaSADE" tooltiptext="Ingrese el nombre del sector correspondiente a la repartición seleccionada a la que desea agregar para enviarle un pase múltiple." >
<bandpopup apply="ar.gob.gcaba.ee.satra.pl.consulta.FindSectorBusquedaSADEBandboxComposer"
id="sectorComboBusquedaSADE" width="650px">
<groupbox mold="3d">
<vbox>
<hbox>
<textbox id="textoSectorBusquedaSADE" />
</hbox>
<paging id="pagingSectorDocsSADE" pageSize="10" />
<listbox mold="paging"
width="600px" id="sectoresBusquedaSADEListbox"
model="#{listaSectorSADESeleccionado}"
selectedItem="#{sectorSeleccionado}"
paginal="${pagingSectorDocsSADE}">
<listhead>
<listheader label="Código" width="30%" />
<listheader label="Nombre" height="70%" />
</listhead>
<listitem self="#{each=sector}">
<listcell label="#{sector.codigo}" />
<listcell label="#{sector.nombre}" />
</listitem>
</listbox>
</vbox>
</groupbox>
</bandpopup>
</bandbox>
</window>
</zk>
The listbox "sectoresReparticionesBusquedaSADEListbox" has the problem, the "sectoresBusquedaSADEListbox" don't have this problem, and for me both are equal.
I finally solved this resetting the binder every time thath i open the BandPopup:
private void resetComponent() {
this.binder = new AnnotateDataBinder(sectoresReparticionesBusquedaSADEListbox);
this.binder.bindBean("sectorReparticionSeleccionada", this.sectorReparticionSeleccionada);
this.binder.loadAll();
this.listaSectorReparticionSeleccionada = new ArrayList<ReparticionBean>();
this.binder.bindBean("listaSectorReparticionSADESeleccionada", this.listaSectorReparticionSeleccionada);
}

PropelORM+PostgreSQL: How do I define an SQL-like CHECK constraint on a column in 'schema.xml'?

A little snippet of a database schema I'm trying to define in my "schema.xml" file:
<table name="hotelroom" phpName="hotelroom">
<column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" />
<column name="room_number" type="varchar" size="10" required="true" />
<column name="price" type="numeric" defaultValue="1000" required="true" />
<unique>
<unique-column name="room_number" />
</unique>
</table>
In PostgreSQL for that "price" column I would've written CHECK (price > 0::numeric),but I can't seem to find any way to achieve this here.I've checked the documentation (http://propelorm.org/documentation/reference/schema.html), but couldn't find anything on this.
Thank you for the time.
You're using v1, but from the doc link above, looks like you're using v2,
I think you're looking for the GreaterThan which is only available from v2 onwards.
<behavior name="validate">
<parameter name="rule1" value="{column: price, validator: GreaterThan, options: {value: 0, message=Price is not valid}}" />
</behavior>

Intuit QBO Reports API -- What's the full qzurl URL?

The documentation for the Intuit Partner Platform (IPP) QBO v3 API for reports (such as this one for a Balance Sheet) refers to very promising-looking elements called Quick-Zoom URLs (discussed near the bottom of the doc page I linked to).
When you run the report, you get an href element like this (redacted) one:
{u'href': u'ProfitAndLossDetail?token=PANDL_DET&parenttoken=PANDL&crit=accounttype%3D10..14%3Bhigh_date%3D03%2F31%2F2015%3Bnopost%3Dfalse%3Baccount%3Dmx%2C3%2C8%2C20%2C19%2C10%2C36%2C24%2C6%2C21%2C34%2C15%2C193%2C51%2C32%2C26%2C33163%2C77%2C62%2%2C86%2C107%2C60%2C79%2C166%%2C82%2C186%2C108%2C54%2C190%2C101%2C95%2C136%2C71%2C64%3Blow_date%3D01%2F01%2F2015%000740743&groupby=%28Account%2FAccountTypeID%2CAccount%2FOrderName%2CKlass%2FOrderName', u'value': u'53.90'}
What's the full URL I'd construct to actually follow the link?
EDIT: To clarify, I am already able to run the balance sheet report with the qzurl links. What I need help with is building and following the Quick Zoom URLs themselves; the things in the response that are the qzruls...how do I follow those?
You can try all QBO V3 Reports using ApiExplorer.
https://developer.intuit.com/v2/apiexplorer?apiname=V3QBO#?id=Reports
If call these APIs programmatically please feel free to use IDG provided java/C#/php SDKs.
According docs,
Sandbox Base URL to use with development keys: https://sandbox-quickbooks.api.intuit.com/v3
Production Base URL to use with production keys: https://quickbooks.api.intuit.com/v3​
Operation: GET /company/companyId/reports/BalanceSheet?name=value[&...]
Edit Adding Request URL and response [ condition : qzurl=true ]
Request URI : https://quickbooks.api.intuit.com/v3/company/1368908040/reports/BalanceSheet?qzurl=true&requestid=3434534&minorversion=1&
Response -
<?xml version="1.0" encoding="UTF-8"?>
<Report xmlns="http://schema.intuit.com/finance/v3">
<Header>
<Time>2015-05-04T14:28:14-07:00</Time>
<ReportName>BalanceSheet</ReportName>
<ReportBasis>Accrual</ReportBasis>
<StartPeriod>2015-01-01</StartPeriod>
<EndPeriod>2015-05-05</EndPeriod>
<SummarizeColumnsBy>Total</SummarizeColumnsBy>
<Currency>INR</Currency>
<Option>
<Name>AccountingStandard</Name>
<Value>IFRS</Value>
</Option>
<Option>
<Name>NoReportData</Name>
<Value>false</Value>
</Option>
</Header>
<Columns>
<Column>
<ColTitle />
<ColType>Account</ColType>
</Column>
<Column>
<ColTitle>Total</ColTitle>
<ColType>Money</ColType>
</Column>
</Columns>
<Rows>
<Row type="Section" group="TotalAssets">
<Header>
<ColData value="Assets" />
<ColData value="" />
</Header>
<Rows>
<Row type="Section" group="OtherCurrentAssets">
<Header>
<ColData value="Current Assets" />
<ColData value="" />
</Header>
<Rows>
<Row type="Data">
<ColData value="Inventory Asset" id="83" />
<ColData value="0.00" href="QZReport?token=GENERIC_QZREPORT&crit=high_date%3D05%2F05%2F2015%3Bnopost%3Dfalse%3Baccount%3Dmx%2C83%3Blow_date%3D01%2F01%2F2015&parenttoken=BAL_SHEET&cumulative=yes&groupby=%28Account%2FAccountTypeID%2CAccount%2FOrderName" />
</Row>
<Row type="Section" group="AR">
<Header>
<ColData value="Accounts receivable (Debtors)" />
<ColData value="" />
</Header>
<Rows>
<Row type="Data">
<ColData value="Accounts Receivable (Debtors)" id="86" />
<ColData value="4299.00" href="QZReport?token=GENERIC_QZREPORT&crit=high_date%3D05%2F05%2F2015%3Bnopost%3Dfalse%3Baccount%3Dmx%2C86%3Blow_date%3D01%2F01%2F2015&parenttoken=BAL_SHEET&cumulative=yes&groupby=%28Account%2FAccountTypeID%2CAccount%2FOrderName" />
</Row>
</Rows>
<Summary>
<ColData value="Total Accounts receivable (Debtors)" />
<ColData value="4299.00" href="QZReport?token=GENERIC_QZREPORT&crit=high_date%3D05%2F05%2F2015%3Bnopost%3Dfalse%3Baccount%3D86%3Blow_date%3D01%2F01%2F2015&parenttoken=BAL_SHEET&cumulative=yes&groupby=%28Account%2FAccountTypeID%2CAccount%2FOrderName" />
</Summary>
</Row>
</Rows>
<Summary>
<ColData value="Total Current Assets" />
<ColData value="4299.00" href="QZReport?token=GENERIC_QZREPORT&crit=high_date%3D05%2F05%2F2015%3Bnopost%3Dfalse%3Baccount%3D78%2C66%2C83%2C12%2C79%2C4%2C59%2C85%2C7%2C86%3Blow_date%3D01%2F01%2F2015&parenttoken=BAL_SHEET&cumulative=yes&groupby=%28Account%2FAccountTypeID%2CAccount%2FOrderName" />
</Summary>
</Row>
</Rows>
<Summary>
<ColData value="Total Assets" />
<ColData value="4299.00" href="QZReport?token=GENERIC_QZREPORT&crit=high_date%3D05%2F05%2F2015%3Bnopost%3Dfalse%3Baccount%3D78%2C66%2C83%2C12%2C79%2C4%2C59%2C85%2C7%2C86%2C5%2C6%2C8%2C10%2C11%2C13%3Blow_date%3D01%2F01%2F2015&parenttoken=BAL_SHEET&cumulative=yes&groupby=%28Account%2FAccountTypeID%2CAccount%2FOrderName" />
</Summary>
</Row>
<Row type="Section" group="TotalLiabilitiesAndEquity">
<Header>
<ColData value="Liabilities and Equity" />
<ColData value="" />
</Header>
<Rows>
<Row type="Section" group="Equity">
<Header>
<ColData value="Equity" />
<ColData value="" />
</Header>
<Rows>
<Row type="Data">
<ColData value="Opening Balance Equity" id="84" />
<ColData value="0.00" href="QZReport?token=GENERIC_QZREPORT&crit=high_date%3D05%2F05%2F2015%3Bnopost%3Dfalse%3Baccount%3Dmx%2C84%3Blow_date%3D01%2F01%2F2015&parenttoken=BAL_SHEET&cumulative=yes&groupby=%28Account%2FAccountTypeID%2CAccount%2FOrderName" />
</Row>
<Row type="Data">
<ColData value="Retained Earnings" id="2" />
<ColData value="" />
</Row>
<Row type="Data" group="NetIncome">
<ColData value="Profit for the year" />
<ColData value="4299.00" href="ProfitAndLoss?token=PANDL&parenttoken=BAL_SHEET&crit=high_date%3D05%2F05%2F2015%3Bnopost%3Dfalse%3Baccount%3D*%3Blow_date%3D01%2F01%2F2015&cumulative=yes&groupby=%28Account%2FAccountTypeID%2CAccount%2FOrderName" />
</Row>
</Rows>
<Summary>
<ColData value="Total Equity" />
<ColData value="4299.00" />
</Summary>
</Row>
</Rows>
<Summary>
<ColData value="Total Liabilities and Equity" />
<ColData value="4299.00" />
</Summary>
</Row>
</Rows>
</Report>
Edit -
Add the qzURL at then end of the following BASE URL and use OAuth tokens to call this endpoint.
For ex -
https://quickbooks.api.intuit.com/v3/company//reports/QZReport?token=GENERIC_QZREPORT&crit=high_date%3D07%2F05%2F2015%3Bnopost%3Dfalse%3Baccount%3Dmx%2C86%3Blow_date%3D01%2F01%2F2015&parenttoken=BAL_SHEET&cumulative=yes&groupby=%28Account%2FAccountTypeID%2CAccount%2FOrderName
Assume the quickzoom url will be as follows-
"QZReport?token=GENERIC_QZREPORT&crit=high_date%3D07%2F14%2F2014%3Bnopost%3Dfalse%3Baccount%3Dmx%2C41%3Blow_date%3D01%2F01%2F2014&groupby=%28Account%2FAccountTypeID%2CAccount%2FOrderName"
1.Client will first send a request to know all the customization attributes supported for a QZReport .Request will also contain all the filtering criteria or attrobutes set.From above url the request will look like this.
https://quickbooks.api.intuit.com/v3/company/1368908040/customize?report=QZReport&high_date=07/14/2014&group_by=Acccount
Response of this request will be all customization attributes available for the QZReport or transaction report .
eg:{
reportName : "TranscationList"
params:
{
start_date:"",
end_date:"2014-07-14",
date_macro:"Today,YesterDay,ThisYear......"
account:"1,2,3,4,",
.... }
}