I am attempting to double click on a dojo grid to open a document. During this exercise I have found that I cannot execute any events from the dojo grid. Even if I try to execute a relatively simple event such as navigating to a page on the dojo grid events it fails to run at all.
Is there anything that I am missing?
Is there anyway to troubleshoot this?
Thanks,
[edit]
8.5.2
[edit2]
<xe:this.service>
<xe:viewItemFileService contentType="application/json"
defaultColumns="true" var="entry" viewName="RFCID">
</xe:viewItemFileService>
</xe:this.service>
</xe:restService>
<xp:br></xp:br>
<xe:djxDataGrid id="djxDataGrid1" storeComponentId="restService1"
escapeHTMLInData="false" loadingMessage="Loading Data">
<xe:djxDataGridColumn id="djxDataGridColumn1" field="rfcid"
label="RFC ID" width="30" editable="false">
</xe:djxDataGridColumn>
<xe:djxDataGridColumn id="djxDataGridColumn2"
label="Request Title" field="requesttitle" width="200">
</xe:djxDataGridColumn>
<xe:djxDataGridColumn id="djxDataGridColumn3" label="Initiator"
field="initiator" width="100">
</xe:djxDataGridColumn>
<xe:djxDataGridColumn id="djxDataGridColumn4" label="Waiting On"
field="waitingon" width="100">
</xe:djxDataGridColumn>
<xe:djxDataGridColumn id="djxDataGridColumn5" label="Status"
field="rfcstatus" width="150">
</xe:djxDataGridColumn>
<xp:eventHandler event="onRowDblClick" refreshMode="complete"
immediate="true" submit="true">
<xe:this.action>
<xp:openPage name="/Home.xsp" target="newDocument"></xp:openPage>
</xe:this.action>
</xp:eventHandler></xe:djxDataGrid>
<xp:br></xp:br>
</xp:view>
The Extension Library Dojo Data Grid events are client-side, not server-side. That's because it is a Dojo control and the Dojo controls are client-side. See the examples in the demo database or the book for how to get a handle on the current row.
Related
From examples I've seen in the Mastering XPages book and around the web, an xp:dataContext variable should be writable but I can't get it to work.
Below is a simplified version of my code. A button calls an xe:dialog containing a panel with a dataContext variable attended and initial value of "", expecting to be able to write to it from the radioGroup data binding. When the radio is set to a certain value (in this case, != "Yes") I want to unhide a div but it doesn't work. The div does not appear and the txt1 computed text field never changes to reflect the value of the radio.
I have tried both an onclick and onchange event handler but neither seems effective. Are dataContext variables read-only?
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xe="http://www.ibm.com/xsp/coreex">
<xp:button id="btn" value="Button">
<xp:eventHandler event="onclick" submit="true" refreshMode="partial">
<xp:this.action><![CDATA[#{javascript:getComponent('dlg').show()}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
<xe:dialog id="dlg" title="Dialog">
<xp:panel id="panel1" readonly="false">
<xp:this.dataContexts>
<xp:dataContext var="attended" value="" />
</xp:this.dataContexts>
<xp:radioGroup id="activityAttended" value="#{attended}">
<xp:selectItem itemLabel="Yes" />
<xp:selectItem itemLabel="No" />
<xp:selectItem itemLabel="Maybe" />
<xp:eventHandler id="event1" event="onclick" submit="true"
refreshMode="partial" refreshId="target" />
</xp:radioGroup>
<xp:div id="target">
radio: <xp:text id="txt1" value="#{attended}" />
<xp:div id="div1" rendered="#{attended != 'Yes'}">
<xp:text id="txt2" value="#{attended}" />
</xp:div>
</xp:div>
</xp:panel>
</xe:dialog>
</xp:view>
To my knowledge, you can't assign to the variable name for a dataContext. What you could do would be to make the value bound to something that contains another value, like a Map or custom object, and then alter properties on that.
For example, if you made it like var="contextProps" value="${javascript:new java.util.HashMap()}", you could then do things like #{contextProps.attended != 'Yes'} and value="#{contextProps.attended}". Usually, you'll want a more-fleshed-out object than a generic HashMap for this, but it can serve as an example or a useful container in a pinch.
I have created an enhanced Dojo Data Grid in an Xpages App. No I want to add an editable column. I get conflicting info on whether you can do this with viewJsonService or if you must use a viewItemFileService. I can't get either way to work. Would prefer to use Json, as everything that I need to do in this code works in Json, but I cannot even get any data to appear with the FileService. I understand to get the Json to work you need to have a site document set up and allow a "GET."
My code for the viewJsonService is below:
<xp:panel style="width:885.0px;height:300px">
<xe:restService pathInfo="gridData" id="restService1"
jsId="restServiceID">
<xe:this.service>
<xe:viewJsonService viewName="(dbAllRspPCTasks)"
var="rstEntry" systemColumns="4">
<xe:this.columns>
<xe:restViewColumn name="ID">
<xe:this.value><![CDATA[#{javascript:return rstEntry.getColumnValue("ID")}]]></xe:this.value>
</xe:restViewColumn>
<xe:restViewColumn name="status">
<xe:this.value><![CDATA[#{javascript:return rstEntry.getColumnValue("status")}]]></xe:this.value>
</xe:restViewColumn>
<xe:restViewColumn name="category">
<xe:this.value><![CDATA[#{javascript:return rstEntry.getColumnValue("category")}]]></xe:this.value>
</xe:restViewColumn>
<xe:restViewColumn name="title">
<xe:this.value><![CDATA[#{javascript:return rstEntry.getColumnValue("title")}]]></xe:this.value>
</xe:restViewColumn>
<xe:restViewColumn name="notes">
<xe:this.value><![CDATA[#{javascript:return rstEntry.getColumnValue("notes")}]]></xe:this.value>
</xe:restViewColumn>
</xe:this.columns>
<xe:this.keys><![CDATA[#{javascript:return viewScope.get("ID");
}]]></xe:this.keys>
</xe:viewJsonService>
</xe:this.service>
</xe:restService>
<xp:button value="Save" id="button4" style="font-weight:bold;font-size:10pt">
<xp:eventHandler event="onclick" submit="true" refreshMode="norefresh">
<xp:this.script><![CDATA[restServiceID.save();]]></xp:this.script>
</xp:eventHandler>
</xp:button>
<xe:djxDataGrid id="djxDataGrid1"
storeComponentId="restService1" initialWidth="100%"
rowSelector="25px" rowsPerPage="100"
dojoType="dojox.grid.EnhancedGrid" autoHeight="10">
<xe:djxDataGridColumn id="djxDataGridColumn1"
field="category" label="Category">
</xe:djxDataGridColumn>
<xe:this.dojoAttributes>
<xp:dojoAttribute name="autoWidth"
value="true">
</xp:dojoAttribute>
<xp:dojoAttribute name="canSort"
value="false">
</xp:dojoAttribute>
</xe:this.dojoAttributes>
<xe:this.errorMessage><![CDATA["Sorry...error loading tasks"]]></xe:this.errorMessage>
<xe:djxDataGridColumn id="djxDataGridColumn2"
field="status" formatter="displayIcon" width="25px" label="Sts">
</xe:djxDataGridColumn>
<xe:djxDataGridColumn id="djxDataGridColumn3"
label="Task" field="title" width="300px">
</xe:djxDataGridColumn>
<xe:djxDataGridColumn id="djxDataGridColumn4"
label="Notes..." field="notes" width="auto" editable="true">
</xe:djxDataGridColumn>
<xp:eventHandler event="onFocus" submit="false">
<xe:this.script><![CDATA[dijit.byId('#{id:djxDataGrid1}').canSort = function(col){
return false;
};]]></xe:this.script>
</xp:eventHandler>
</xe:djxDataGrid>
</xp:panel>
Per, OK on a test server I created a Web Site Document and checked PUT in the allowed methods and rebooted the server.
When I check
http:///api/data
I get a
{
"code":403,
"text":"Forbidden"
}
and I do not know why. What are some things that I should look for to ensure that I can enable a put?
Bryan
I have got an Xpage with an Restservice (viewJsonService). If I test the RestService with the pathInfo I can see all Documents of the pointing view.
I bind the RestService to a DataGrid with 3 DataGridColumns. The DataGridColumns are pointing to the programmatical name of 3 default columns.
If I preview the Xpage in the Browser I can't see any data. Does anyone has got an idea where the problem can be?
<xe:restService id="restService1" pathInfo="data">
<xe:this.service>
<xe:viewJsonService
databaseName="Bewerbermanagement.nsf"
defaultColumns="true" viewName="($AllDocuments)">
</xe:viewJsonService>
</xe:this.service>
</xe:restService>
<xe:djxDataGrid id="djxDataGrid1" storeComponentId="restService1"
rowsPerPage="30">
<xe:this.dojoAttributes>
<xp:dojoAttribute name="autoWidth" value="true"></xp:dojoAttribute>
<xp:dojoAttribute name="columnReordering" value="true"></xp:dojoAttribute>
</xe:this.dojoAttributes>
<xe:djxDataGridColumn id="djxDataGridColumn1" label="Datum"
width="100px" field="$4">
</xe:djxDataGridColumn>
<xe:djxDataGridColumn id="djxDataGridColumn2" label="Absender"
field="$2" width="100px">
</xe:djxDataGridColumn>
<xe:djxDataGridColumn id="djxDataGridColumn3" label="Subject"
field="SUBJECT" width="100px">
</xe:djxDataGridColumn>
</xe:djxDataGrid>
Example Json-Entry:
{
"#entryid":"1-0590EED09824B814C1257D80003A68C8",
"#unid":"0590EED09824B814C1257D80003A68C8",
"#noteid":"8F6",
"#position":"1",
"#siblings":7,
"#form":"Appointment",
"$4":"2014-10-27T17:27:39Z",
"$2":"Joe Doe",
"SUBJECT":"V\u00D6"
},
I found the error. I changed the Application theme from OneUI V3.02 to OneUI. But I don't know why this has got an effect on building the DataGrid
I suspect this is a silly question, but here goes...
I have two fields on a custom control, both are bound to managed bean properties (as opposed to document fields). The second field is only rendered when a specific value is chosen in the first field.
What I am seeing is that the setter for the second field is not firing after it has been rendered (the getter is firing just fine).
I have worked around the problem by computing the CSS display property on the second field to be block or none depending on the value in the first field. Everything works fine in this situation, it seems to be specifically related to whether the second field is rendered when the page is first loaded.
***Edit
Here's the sample code block:
<div class="control-group">
<xp:label value="Party Type:" id="partytypelabel" for="party_typetv">
</xp:label>
<div class="controls">
<xp:comboBox id="party_typetv" value="#{InvolvedRecord.partytypetv}"
required="true" defaultValue=""
readonly="#{javascript:!InvolvedManager.isInEditMode()}">
<xp:selectItem itemLabel="<select>" itemValue="">
</xp:selectItem>
<xp:selectItems>
<xp:this.value><![CDATA[#{javascript:InvolvedManager.getPartyTypes()}]]></xp:this.value>
</xp:selectItems>
<xp:eventHandler event="onchange" submit="true"
refreshMode="partial" disableValidators="true" refreshId="partyfields">
</xp:eventHandler>
</xp:comboBox>
</div>
</div>
<xp:panel id="partyfields" tagName="fieldset">
<xp:this.rendered><![CDATA[#{javascript:InvolvedManager.hasPartyType()}]]></xp:this.rendered>
<xp:div styleClass="control-group">
<xp:label for="Adverse_Party_TypeTL" value="Type:" id="adversepartytypelabel">
</xp:label>
<div class="controls">
<span>
<xp:comboBox id="Adverse_Party_TypeTL"
value="#{InvolvedRecord.adversepartytypetl}" readonly="#{javascript:!InvolvedManager.isInEditMode()}">
<xp:selectItem itemLabel="<select>"
itemValue="">
</xp:selectItem>
<xp:selectItem itemLabel="Company" itemValue="Company">
</xp:selectItem>
<xp:selectItem itemLabel="Individual" itemValue="Individual">
</xp:selectItem>
<xp:eventHandler event="onchange" submit="true"
refreshMode="partial" disableValidators="true" refreshId="adversepartyfields">
</xp:eventHandler>
</xp:comboBox>
</span>
</div>
</xp:div>
</xp:panel>
***End Edit
This is running on an 8.5.3 server.
Has anyone seen anything like this or maybe offer an explanation as I am confused!
You could render the component in all phases except the renderphase. This would allow to set the value during update phase, but would hide it to the client.
Here is an example:
Conditionally hidden edit box in a partially refreshed panel
EDIT:
<xp:this.rendered>
<![CDATA[#{javascript:
if( view.isRenderingPhase() ){
return InvolvedManager.hasPartyType();
}else{
return true;
}
}]]>
</xp:this.rendered>
Are you actually entering data into these fields after they have been rendered? I have found on many occasions that a field specifically bound to a managed bean does not actually even do anything unless some data has been entered into it. For instance, I have seen this: render the field dynamically, don't do anything to it, save the data source, no field whatsoever on the document. If I do that same activity but add data to the field, then it all works. Not an answer. Just some info.
I would like to use the Dojo Data Grid/REST service architecture in an application I am building. However, I cannot find the property (or code) to have the REST service point to a view in another application outside the current one.
Can I use a Data Context in the view name of the REST Service? Or is there another property to set to point to a view in another application?
Thanks -- appreciate your help!
--------- EDIT 6/24/2013 ---------
I have tried both the viewItemFileService and viewJSONService and I can only get the viewJSONService to work with the other database. The viewItemFileService just displays "Sorry, an error has occurred" where the rows of data should be. Here is the code -- I am not sure where I am making the mistake:
<xp:panel>
View JSON<xp:br></xp:br>
<xe:restService id="restService1">
<xe:this.service>
<xe:viewJsonService databaseName="voca/vocadatastore.nsf"
defaultColumns="true" viewName="InvoicePersonnel" var="entry1"
contentType="application/json">
</xe:viewJsonService>
</xe:this.service>
</xe:restService>
<xe:djxDataGrid id="djxDataGrid2" autoHeight="10"
storeComponentId="restService1">
<xe:djxDataGridColumn id="djxDataGridColumn5"
label="Description" field="description" width="auto">
</xe:djxDataGridColumn>
<xe:djxDataGridColumn id="djxDataGridColumn6"
label="Items" field="items" width="auto">
</xe:djxDataGridColumn>
<xe:djxDataGridColumn id="djxDataGridColumn7"
label="Cost" field="cost" width="auto">
</xe:djxDataGridColumn>
<xe:djxDataGridColumn id="djxDataGridColumn8"
label="Total" field="total" width="auto">
</xe:djxDataGridColumn>
</xe:djxDataGrid>
</xp:panel>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:panel>View Domino<xp:br></xp:br>
<xe:restService id="restServicePers">
<xe:this.service>
<xe:viewItemFileService databaseName="voca/vocadatastore.nsf"
defaultColumns="true" viewName="InvoicePersonnel" var="entry2">
</xe:viewItemFileService>
</xe:this.service>
</xe:restService>
<xe:djxDataGrid id="djxDataGrid1" autoHeight="10"
storeComponentId="restServicePers">
<xe:djxDataGridColumn id="djxDataGridColumn1"
label="Description" field="description" width="auto">
</xe:djxDataGridColumn>
<xe:djxDataGridColumn id="djxDataGridColumn2"
label="Items" field="items" width="auto">
</xe:djxDataGridColumn>
<xe:djxDataGridColumn id="djxDataGridColumn3"
label="Cost" field="cost" width="auto">
</xe:djxDataGridColumn>
<xe:djxDataGridColumn id="djxDataGridColumn4"
label="Total" field="total" width="auto">
</xe:djxDataGridColumn>
</xe:djxDataGrid>
</xp:panel>
--------- EDIT 7/3/2013 ---------
I moved the view to the same database as the REST service and still received "Sorry, an error occurred" message. The view name is correct since I selected the viewName from the list. The column title/field name is correct also.
<xe:restService id="restServicePers" pathInfo="persInfo">
<xe:this.service>
<xe:viewItemFileService defaultColumns="true"
viewName="InvoicePersonnel" var="entryPers">
</xe:viewItemFileService>
</xe:this.service>
</xe:restService>
<xe:djxDataGrid id="djxDataGrid1" autoHeight="10"
storeComponentId="restServicePers">
<xe:djxDataGridColumn id="djxDataGridColumn1"
label="Description" field="description" width="auto">
</xe:djxDataGridColumn>
</xe:djxDataGrid>
I added the pathInfo property to the REST service to see what is being returned and there was an error:
{
"code":500,
"text":"Internal Error",
"message":"",
"type":"text",
"data":"java.lang.NullPointerException\r\n\tat com.ibm.domino.services.rest.das.view.RestViewNavigatorFactory$ViewNavigatorNavigator.getTopLevelEntryCount(RestViewNavigatorFactory.java:565)\r\n\tat com.ibm.domino.services.rest.das.view.RestViewItemFileService.renderServiceJSONGet(RestViewItemFileService.java:263)\r\n\tat com.ibm.domino.services.rest.das.view.RestViewItemFileService.renderService(RestViewItemFileService.java:77)\r\n\tat com.ibm.domino.services.HttpServiceEngine.processRequest(HttpServiceEngine.java:167)\r\n\tat com.ibm.xsp.extlib.component.rest.UIBaseRestService._processAjaxRequest(UIBaseRestService.java:242)\r\n\tat com.ibm.xsp.extlib.component.rest.UIBaseRestService.processAjaxRequest(UIBaseRestService.java:219)\r\n\tat com.ibm.xsp.util.AjaxUtilEx.renderAjaxPartialLifecycle(AjaxUtilEx.java:206)\r\n\tat com.ibm.xsp.webapp.FacesServletEx.renderAjaxPartial(FacesServletEx.java:225)\r\n\tat com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:170)\r\n\tat com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:160)\r\n\tat com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:138)\r\n\tat com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:103)\r\n\tat com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:583)\r\n\tat com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1281)\r\n\tat com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:854)\r\n\tat com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:751)\r\n\tat com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:572)\r\n\tat com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1265)\r\n\tat com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:658)\r\n\tat com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:481)\r\n\tat com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:341)\r\n\tat com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:297)\r\n\tat com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)\r\n"
}
There is a property databaseName in service definitions
xe:viewItemFileService
xe:viewJsonLegacyService
xe:viewJsonService
xe:viewXmlLegacyService
in xe:restService.
If it's empty then the current database is used but if you put in path and name of a database then those database is used.
The view name is defined in property viewName.
<xe:restService id="restService1">
<xe:this.service>
<xe:viewItemFileService
databaseName="MyFolder/MyOtherDatabase.nsf"
viewName="AllContacts"
...>