Cant get the view to show up on the TeamStudio Unplugged app - xpages

I have tried putting the view into a custom control and then putting the custom control in the UnpMain.xsp, and I have tried putting it directly into the UnpMain.xsp, neither of these works. I can get other components to show, such as text fields, check-boxes, labels, and so on but for whatever reason the view will not show in my app, when I open the UnpMain.xsp within a browser it shows perfectly fine, so it is not an ACL issue.

(Stephan is right: source code would be useful, but I'll make an educated guess...)
I'm assuming you've added an <xp:viewPanel> to the XPage. That won't work, because Unplugged doesn't support that control. See also this page with all supported controls.
It does however support the <xp:repeat> control. That also the way in Unplugged to add a list (view) to a page. For example:
<xp:this.data>
<xp:dominoView
var="view1"
viewName="default">
</xp:dominoView>
</xp:this.data>
<table class="table">
<tbody>
<xp:repeat
id="repeat1"
rows="30"
value="#{view1}"
var="row">
<tr>
<td>
<xp:link text="#{row.name}"><xp:this.value><![CDATA[#{javascript:"doc.xsp?documentId=" + row.getUniversalID() + "&action=editDocument"}]]></xp:this.value></xp:link>
</td>
<td>
<xp:text
escape="true"
id="computedField2"
value="#{row.city}">
</xp:text>
</td>
</tr>
</xp:repeat>
</tbody>
</table>
One more thing: I would recommend to download the latest version of the XControls project. You can either start using that in your project or to take a look the source code.

Related

Material Design Lite Lists - how to access selected elements?

I'm using Aurelia framework with Material Design Lite via plugin "aurelia-mdl-plugin".
I have the following markup:
<table class="mdl-data-table mdl-js-data-table mdl-data-table--selectable mdl-shadow--2dp">
<thead>
<tr>
<th class="mdl-data-table__cell--non-numeric">Name</th>
<th>Col2</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr repeat.for="s of items">
<td class="mdl-data-table__cell--non-numeric">${s.name}</td>
<td>${s.someothercol}</td>
<td>View</td>
</tr>
</tbody>
</table>
This markup represents a list of items that are selectable - each of them gets a checkbox with ability to select + the list gets "select all" check box in the header.
The problem is that since this additional markup with checkboxes is generated by MDL I can't really bind to it.
If I had a checkbox manually inserted I would do something like:
<input type="checkbox" checked.bind="s.IsChecked" />
Is there any way to fix this?
PS> I don't think it's necessarily Aurelia specific. Most likely I would have the same problem in Angular or other library..
The mdl team officially deprecated automatic checkbox insertion. So now you should write them down manually, which would solve your binding issue.
See this link: https://github.com/google/material-design-lite/wiki/Deprecations#automatic-selection-checkboxes

Extra Buttons on SharePoint 2013 NewForm.aspx

I have a site, when the user completes viewing items on the site, they click a complete button (that was hidden until they completed the required tasks) that pops up a NewForm for the attendance list. Once the user adds their name and clicks save, the NewForm should close. I created a NewForm (NewForm_CloseAfter.aspx) and pointed the site to open the NewForm_CloseAfter.aspx (no problems so far).
See code below. I commented out the SharePoint button and added the html input button.
The problem: My html input button at the bottom of the form works fine. However, looks like the default save/cancel button is at the top with the default behavior of submitting the information and showing the list (unwanted behavior)
The Question: How can I remove the default buttons at the top of my form?
Thanks
<tr>
<td class="ms-toolbar" nowrap="nowrap">
<table>
<tr>
<td width="99%" class="ms-toolbar" nowrap="nowrap"><IMG SRC="/_layouts/15/images/blank.gif" width="1" height="18"/></td>
<td class="ms-toolbar" nowrap="nowrap">
<!--<SharePoint:SaveButton runat="server" ControlMode="New" id="savebutton2"/>-->
<input name="Submit1" type="submit" value="Save" id="savebutton2" style="width:75px" onclick="javascript: {ddwrt:GenFireServerEvent('__commit')}; window.alert('Item updated.') ; window.close();" />
</td>
<td class="ms-separator"> </td>
<td class="ms-toolbar" nowrap="nowrap" align="right">
<SharePoint:GoBackButton runat="server" ControlMode="New" id="gobackbutton2"/>
</td>
</tr>
</table>
</td>
</tr>
Edit the your custom new form in designer and search for "savebutton1". Find the surrounding tr and comment out it and you are done.

Trying to delete the selected item in the XPages repeat control, but does not work

I am trying to delete the selected item in the Xpages repeat control, but it does not work. Please help?
Here is my code in the repeat control section
<xp:repeat id="repeat1" rows="30" var="eachQuestion" value="#{questions}"
indexVar="rowIndex">
<tr>
<td>...</td>
<td> <xp:link styleClass="btn btn-danger" id="deleteLink">
<xp:eventHandler event="onClick"
action="#{javascript:eachQuestion.getDocument().remove(true);}"
submit="true"
refreshMode="partial"
refreshId="listContainer" />
<i class="fa fa-lg fa-trash-o" />
</xp:link> </td>
</tr>
</xp:repeat>
Here is what I can see in the client page, generated html and JS code:
XSP.addOnLoad(function() {
XSP.attachPartial("view:_id1:repeat1:0:_id44","view:_id1:repeat1:0:deleteLink", null, "onClick", function(){}, 2, "view:_id1:listContainer");
When I click the delete link icon, nothing happened.
I realized function(){} nothing in there.
Is there anything wrong or I have to implement the method in the Java code to handle this deletion?
Thanks,
You just have to change "onClick" to "onclick" in your code and it will work.
Case sensitivity does matter in Xpages. So, your code to delete a document is right but the event "onClick" doesn't gets executed at all.
You don't say what "questions" is. I assume it's a view. The code looks right to me. You certainly do NOT need Java to delete a document from a rpw in a repeat control.
I would ignore the client side stuff. That's server generated. It's supposed to be empty I think. The server knows what to do.
First check the database ACL. Make sure the user has delete access. I'd also add a Display Errors control on the page. If it's not deleting due to a validation issue it should show there. Then I'd go to OpenNTF and get the XPages Log Reader control. It's a small xpages database that let's you see errors more easily.
I'd start with those ideas.
By the way that's not a good way to do a table in a repeat control. It should be producing invalid HTML. You should use Facets. That is NOT your problem though.

Xpages Link Open New Browser Tab

I have found a few similar questions to this in stackoverflow but nothing exactly matches. I am attempting to amend an Xpages project where the search results are shown in a Dynamic View Panel. The first column of the search results is a link that opens the record in the same page. What I want to do is have this link open the record in a seperate page. It is the "Dynamic" part of the view that is confusing I think as there is no "Column Name" or "Column View" to add in a window.open or a target="_blank" that I can see. How would I go about this please?
The relevant section of the XPage only has the following;
<xp:panel id="maincontentpanel">
<xe:dynamicViewPanel rows="30" id="dynamicViewPanel1" width="100%">
<xe:this.data>
<xp:dominoView viewName="(keywordsUser)" var="view">
</xp:dominoView>
</xe:this.data>
</xe:dynamicViewPanel>
</xp:panel>
When viewing the source in HTML the clickable column shows the following;
<tr>
<td class="xspColumnViewStart">
<a id="view:_id1:cc4cconeuilayout:OneUIMainAreaCallback:dynamicViewPanel1:0:_id6:_internalColumnLink"
href="*routetoourrecord*";action=editDocument"
class="xspLinkViewColumn">2014</a>
</td>
Dynamic View Panel has a property "target" in All Properties where you can select "_blank". This should add the attribute target="_blank" to the links in first column. But, unfortunately, this works in Notes client only.
So, there is no property we just can set. Luckily, rendered links have an own class "xspLinkViewColumn" (see your source HTML example). With dojo.query we can get all elements with this class and add the target attribute on client side.
Just add following event code to your XPage:
<xp:eventHandler
event="onClientLoad"
submit="false">
<xp:this.script><![CDATA[
dojo.query(".xspLinkViewColumn").attr("target", "_blank");
]]></xp:this.script>
</xp:eventHandler>
All links will get the attribute target="_blank" this way and documents will be opened in a new browser tab.
Just to let know the code does not to work with the Bootstrap theme.
Instead you can use
dojo.query('[id$="_internalColumnLink"]').attr("target", "_blank");

xe:dialog won't open in edit mode with view picklist OpenNTF control

I'm using the Extension Library and XPages to build a web based workflow application. One feature is to prompt a dialog and select the next approver before submitting it forward.
For new documents, the dialog appears, and it also appears when in read mode. It never opens for a saved document. I need it to work in SSJS, though the dialog does open in CSJS. Here is some of the code:
xpMain.xsp contains two custom controls: ccButtons and ccWFloDialogs.
ccButtons "Submit" button:
getComponent('dlgNextOwner').show();
ccWFloDialogs "dlgNextOwner" dialog:
<xe:dialog id="dlgNextOwner" title="Select Supervisor">
<xe:formTable id="ftDlgNextOwner" formTitle="Select Supervisor"
formDescription="You may select a different supervisor."
disableErrorSummary="true">
<xp:this.facets>
<xe:formRow id="formRow1" xp:key="footer" for="txtWFloNextOwner"
labelWidth="125px">
<xp:inputText id="txtWFloNextOwner" style="width:200px"
value="#{viewScope.nextOwner}">
</xp:inputText>
<xe:namePicker id="npNextOwner" dialogTitle="Select Supervisor"
for="txtWFloNextOwner">
<xe:this.dataProvider>
<xe:dominoNABNamePicker addressBookSel="all-public"></xe:dominoNABNamePicker>
</xe:this.dataProvider>
</xe:namePicker>
</xe:formRow>
</xp:this.facets>
</xe:formTable>
</xe:dialog>
In CSJS, I can use the following code and it successfully opens the dialog:
XSP.openDialog("#{id:dlgNextOwner}");
I'm also using Mark Hughes' picklist from the extension library, and if I remove the panel which contains the control and data source, the dialog shows up in SSJS! The code is in a custom control, although, if it's directly in the XPage, the problem is the same. Here is the code for the panel:
<xp:panel
id="vendorDiv">
<xp:this.data>
<xp:dominoView
var="nvVend"
viewName="V_Vend"
ignoreRequestParams="true"
databaseName="other/lookupdb.nsf"
startKeys="#{javascript:viewScope.srchVend}">
</xp:dominoView>
</xp:this.data>
<xe:formTable
id="ftGetVendor"
disableErrorSummary="true"
labelPosition="above">
<xe:formRow
id="frVendor"
for="cfVendorName"
label="Name of the Vendor:">
<xp:text
escape="true"
id="cfVendorName"
value="#{currentDocument.VendorName}"
style="width:200px">
</xp:text>
<xc:viewpicklist
rowsPerPage="15"
buttonImage="./add.png"
tableClass="tablecellgreen"
headerClass="headerclass"
rowClass="odd, even"
searchBar="false"
searchButtonText="Search"
searchButtonClass="button2"
searchBarClass="headerclass"
pagerStyleFirst="navbutton1"
pagerStylePrevious="navbutton2"
pagerStyleCurrent="navbutton4"
pagerStyleNext="navbutton2"
pagerStyleLast="navbutton3"
typeAheadBar="true"
select="Column"
onReturn="Set Scope Value"
bottomBarClass="bottomround headerclass"
cancelButtonText="Cancel"
cancelButtonClass="button2 floatthisright"
type="Single Value"
finishButtonText="Finish"
finishButtonClass="button2 floatthisright"
multiSelectButtonAddImg="./add.png"
multiSelectButtonRemoveImg="./delete.png"
picklistButtonClass="button"
openDialogWith="Link"
picklistLinkImg="./add.png"
multiSelectLinkAddImg="./add.png"
multiSelectLinkRemoveImg="./delete.png"
selectWith="Link"
clearSearchImg="./cross.png"
SelectCellWidth="30px"
dialogID="dlgVend"
dialogTitle="Select a Vendor"
dialogWidth="80%"
refreshID="vendorDiv"
ssjsSelectFunction="getVendorInfo"
varName="viewScope.vendorInfo"
datasrc="nvVend"
selectColumn="4"
linkImg="./add.png"
typeAheadVar="viewScope.srchVend">
<xc:this.viewColumn>
<xp:value>0</xp:value>
<xp:value>1</xp:value>
<xp:value>2</xp:value>
<xp:value>3</xp:value>
</xc:this.viewColumn>
</xc:viewpicklist>
</xe:formRow>
<xe:formRow
id="frVendorStatus"
for="cfVendorStatus"
label="Vendor Registration Status:">
<xp:text
escape="true"
id="cfVendorStatus"
value="#{currentDocument.VendorStatus}">
</xp:text>
</xe:formRow>
<xe:formRow
id="frVendorCountry"
for="cfVendorCountry"
label="Country Name:">
<xp:text
escape="true"
id="cfVendorCountry"
value="#{currentDocument.VendorCountry}">
</xp:text>
</xe:formRow>
</xe:formTable>
</xp:panel>
The requested vendor information populates the fields, without any problem or errors. However, something here seems to prevent dialogs from opening up using SSJS.
Can anyone see anything obvious I'm missing? The data source is in the panel, ignoreRequestParams is true (otherwise it doesn't work).
The main data source is in the entire XPage context. I tried to add the ccWFloDialog custom control outside the main panel, and change the data source to the panel, but that didn't work.
Any ideas?
Forget the dialog for now. This is probably data source related. Suggest you get it working just on the xpage first. With visible fields. then maybe use the rendered property to get it working on the xpage similar to how the dialog would appear. Once you have that working then you should be good to apply to dialog. This idea is to just take the dialog out of the equation first to make sure it works normally.
Instead, I decided to open the dialogs using CSJS, instead of SSJS. I've changed some of logic, and will have a bit more to do to finish this part of the project. Thanks to all!

Resources