ZK framework getting value of a component on zul page - zk

I am trying to get the value of a textbox on a zul page by using some kind of getValue method. I should handle this on the zul page, not on a controller. I need to assign a listbox cell (which is the first cell of the list box below) with a value coming from the textbox.
<listcell>
<label value="" />
</listcell>
<listcell>
<toolbarbutton visible="true"
image="/resources/images/icons/1616/page_text.gif" />
</listcell>
<listcell>
<label value="#{file.name}" />
</listcell>
<listcell>
<toolbarbutton forward="onClick=onRemoveMultipleFiles"
visible="true" id="newFileAndCommentRemove" image="/resources/images/icons/1616/delete.png" />
</listcell>
</listitem>

If what you want is that after the textbox is filled then the first cell will fill with its value you can do it like this:
put an id into the label in the cell
put an onChange operation in the textbox so when the textbox change you can put its value into the cell
like this:
<textbox id="textbox" onChange="label.setValue(self.getValue())"/>
<listbox id="newFileAndComment">
<listhead>
<listheader label="1" width="30px" />
</listhead>
<listitem self="#{each=file}">
<listcell>
<label id="label"/>
</listcell>
</listitem>

Related

salesforce lightening Page- Disable Aura popup component

I added one aura component to Opportunity lightening page. when doInit method start then That aura component will display popup component. I added some visibility filter conditions to that aura component so when conditions are met then component will display.
if i open opportunity record page in edit page mode then aura popup component is displaying.
Question : what is the best way to disable popup in page edit mode only.
<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction"
access="global"
controller='CustomerProductRequirementsController'>
<aura:attribute name="isOpen" type="boolean" default="false" />
<aura:attribute name="areThereCPReqs" type="boolean" default="false" />
<aura:attribute name="disablebutton" type="boolean" default="false" />
<aura:attribute name="toggleSpinner" type="boolean" default="false"/>
<!--aura:attribute name="test" type="string" default="nothing"/-->
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<!--h1>info-{!v.test} </h1-->
<aura:if isTrue="{!v.isOpen}" >
<div style="height:640px">
<section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open">
<div class="slds-modal__container">
<div class="slds-modal__content slds-p-around_medium" style="width:80%" id="modal-content-id-1">
<span class="slds-m-left_xx-large"><b>Are there customer product requirements? </b></span>
<lightning:button label="Yes" class="slds-button slds-button_brand slds-m-left_medium" onclick="{!c.handleYesORNoAction}" name="YES" disabled="{!v.disablebutton}"/>
<lightning:button label="No" class="slds-button slds-button_brand slds-m-left_small" onclick="{!c.handleYesORNoAction}" name="NO" disabled="{!v.disablebutton}"/>
<aura:if isTrue="{!v.toggleSpinner}">
<div class="slds-spinner slds-spinner_xx-small " role="alert" style="position:absolute;top:50%;left:5%;" aura:id="toggleSpinner" >
<lightning:spinner alternativeText="Loading" size="small" />
</div>
</aura:if>
</div>
</div>
</section>
<div class="slds-backdrop slds-backdrop_open"></div>
</div>
</aura:if>
</aura:component>
**controller.js **
({
doInit: function(component, event, helper) {
component.set("v.isOpen", true);
},
handleYesORNoAction: function(component, event, helper) {
helper.Helper_CreateGCSRRecords(component,event);
component.set("v.disablebutton",true);
component.set("v.toggleSpinner", true);
},
})

SAPUI5 Googlemaps library : multiple directions via list

enter image description here
<openui5.googlemaps:Waypoint id = "waypoint" location="{location}"/>
<!--<openui5.googlemaps:Waypoint location="Talod"/>-->
</openui5.googlemaps:waypoints>
</openui5.googlemaps:Directions>
</openui5.googlemaps:directions>
</openui5.googlemaps:Map>
<Input id="start" value="{start}" width="180px" placeholder="Start Address">
<layoutData>
<FlexItemData growFactor="2"/>
</layoutData>
</Input>
<Input id="end" value="{end}" width="180px" placeholder="End Address">
<layoutData>
<FlexItemData growFactor="2"/>
</layoutData>
</Input>
<Button text="Find distance" type="Emphasized" width="170px" press="go"></Button>
</content>
</Page>
</pages>
</App>
Above code is of the view.I am adding code of controller but could not able to add it.I am having desired result for one start and end address but I could not able to have multiple lines for start and end address on same map.I need multiple lines with pin points as shown in image.

How to add views to the steps of a roadmap in sapui5

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

How to change grid default status in a ZK theme?

I have a page built with ZK. In this page there is a button that start a search. If there are some data them appear in a grid view.
Every data are built in this way:
v Date1 (dd/mm/yyyy)
- item
- item
- item
v Date2 (dd/mm/yyyy)
- item
- item
Lecter V means an arrow but I can't post an image so I use a "v" that have similar image to undestand.
It works correctely but there is a problem.
I would have this situation:
Date1 (dd/mm/yyyy)
Date2 (dd/mm/yyyy)
When I click on a date I want that the arrow became "v" and all data appear.
If in the first case I click on date it became close.
How to change the default view of grid items?
This is my code
<grid id="demoGrid" width="50%" height="400px" style ="float:left"
model="#bind(vm.value)" emptyMessage="No data">
<columns menupopup="auto">
<column sort="auto(Hour)" label="Hour" width="150px"/>
<column sort="auto(Value)" label="Value(bpm)" hflex="1" />
</columns>
<!-- template for group -->
<template name="model:group">
<group label="#load(each)" />
</template>
<!-- template for each element in model -->
<template name="model" >
<row>
<label value="#load(each.hour)" />
<label value="#load(each.value)" />
</row>
</template>
<!-- template for footer -->
<template name="model:groupfoot">
<groupfoot>
<cell colspan="5" style="text-align: right; padding-right: 15px">
<label value="#load(each)" style="font-weight:bold;" />
</cell>
</groupfoot>
</template>
</grid>
I try to use tag details in this subcode:
<template name="model">
<details open="false">
<row>
<label value="#load(each.hour)" />
<label value="#load(each.value)" />
</row>
</details>
</template>
Try the details like this :
<template name="model">
<row>
<detail open="false">
<hlayout>
<label value="#load(each.hour)" />
<label value="#load(each.value)" />
</hlayout>
</detail>
<label value="second column"/>
</row>
</template>
Explication :
Detail can have only 1 root element so that's why we set the the hlayout.
Of course you can change this to div or whatever you want.
The row tag has to be outside the detail tag.
The detail take a column so for this example you need to provide 2 columns.
Edit :
I created a fiddle.

how to populate a drop down(<s:select) in struts2 from json response

i am unable to populate my Struts2 select drop down in my jsp page.
Note: My jsp page loads through json response.
I have a select box inside a form. But i don't t know how to populate it when my jsp page loads.
And in the same page i have a select dropdown in my Struts2 jquery grid,which i am able to populage but i don't know how to populate a drop down for my form which are out side of the grid.
Please help me regarding this issue.
my jsp page
<s:url id="selecturl" action="selectaction"/>
<s:url id="bookediturl" action="bookeditt"/>
<s:url id="bookremoteurl" action="booksetups"/>
<sjg:grid
id="bookgrid"
formIds="form2"
reloadTopics="reloadMyGrid"
caption="List of Cover Details"
dataType="json"
href="%{bookremoteurl}"
pager="true"
gridModel="gridModel"
rowList="50,100,5000"
rowNum="20"
filter="true"
filterOptions="{stringResult :false,searchOnEnter : false,enableClear : true,gridModel : true}"
rownumbers="true"
editurl="%{bookediturl}"
navigator="true"
editinline="true"
navigatorSearch="false"
autowidth="false"
width= "1550"
viewrecords="true"
navigatorRefresh="true"
navigatorDelete="true">
<sjg:gridColumn name="id" index="locationId" title="ID" formatter="integer" sortable="false" key="true"
search="false" editable="true" hidden="true" />
<sjg:gridColumn name="authLastname" index="authLastname" title="AuthorLastname" sortable="true" search="true" editrules="{required: true}"
editable="true" edittype="text" />
<sjg:gridColumn name="subjectId" title="Subject Name" editable="true" sortable="false" align="center" search="false" searchtype="select"
searchoptions="{dataUrl:'%{selecturl}'}" edittype="select" editoptions="{dataUrl:'%{selecturl}'}" />
</sjg:grid>
<div id="myDivBox" style="display:none; width :300px;position: relative;top: -30px;left: 299px;button:0px;">
<s:form action="searchkeywordss" id="form2" theme="simple" cssClass="yform">
<sj:textfield placeholder="Enter keyword to search" cssClass="txtbox" size="42" maxLength="255" name="keywordsearch"/>
<sj:select href="%{selecturl}" name="countryselect" list="%{lstsub}" listKey="id" listValue="subjectName" theme="jquery" cssStyle="margin-top:4px;"/>
<sj:a button="true" id="btnid" cssStyle="position: relative;top: 0px;left: 09px;" onClickTopics="reloadMyGrid">Find</sj:a>
</s:form>
</div>
struts.xml
<action name="booksetups" class="v.esoft.actions.bookdetails.BookdetailsAction" >
<result name="success" type="json"/>
<result name="login" type="redirect"> /index.jsp </result>
</action>
<action name="selectaction" class="v.esoft.actions.bookdetails.SelectAction">
<result name="success">/select.jsp</result>
</action>
You should only use the sj:select like below
<sj:select href="%{selecturl}" name="countryselect" list="subjectList" listKey="id" listValue="subjectName" theme="jquery" cssStyle="margin-top:4px;"/>
where selecturl returns a json response, subjectList is name of list in the json reponse which contains the options
Your selectaction should have a json response, but what you have now is an action returning a jsp so it would not work. If you cannot change it, you should create another action which returns json.