CollapseAll with one document causes no text to display - xpages

I have some categorized views on individual xpages. I have a button on the page which can collapse the views.
var viewPanel:com.ibm.xsp.component.xp.XspViewPanel = getComponent("viewPanel1");
try {
viewPanel.gotoFirstPage();
}
catch (e) {
}
var model = viewPanel.getDataModel();
model.getDominoViewDataContainer().collapseAll();
If there is only one document in the view and the view is collapsed, then no text is displayed in the view. Is anyone else seeing this behavior?
I can't tell you the grief this one caused me. I never suspected in would be the collapse that was causing the document not to display.
Clarification: The column titles are displayed. It is that the document is not displayed when collapse all is used. Also it looks it looks like no documents are being displayed after collapse all even when there are more than one document. View in notes client displays fine.

Figured this one out. It seemed to be multiple issues.
I had a computed field in the first column, of the actual view, to show the count. View Panel does not seem to like this. I moved the "count" column to the right beyond the categorized fields.
Some of the views seemed to have a problem wih the programmatic column. I removed all of the $XX values and gave them my own name.
Ctrl-Shift-F9 in the client seemed to fix remaining issues with other views.

I am seeing the same thing when using 8.5.3 server, but a replica on Domino 9 does not appear to exhibit this behaviour. I haven't been able to determine other cause yet, but appreciate some of the items you described.

Related

How to create a NotesRichtext item that is computed for display?

I know this is a common problem, and I tried a few solutions already, but the problem I have right now with my current code is that even though the attachments show in the computed for display field, I get the error "Note Item not Found" when I try to open them.
The form is built with two fields, in a programmable table that displays the editable one or the computed for display one.
The trick I found with Google's help was to delete the computed for display item in the queryopen event, so Notes regenerates the cfd item when opening the document. Visually, this works, as I see the text and attachments, but the attachments can't be opened.
Here is the code that removes the item in the QueryOpen of the form:
...
Set item = doc.GetFirstItem("dspDescription")
If Not item Is Nothing Then Call item.Remove()
...
Has anyone successfully achieved that functionality? Is there another way of doing this? I already tried with subforms, and because of the way the application is built, I need to be able to switch from editable to read only on the flick of a radio button, so subforms are out of the question as they can't be displayed dynamically.
Why don't you simple put the richtext item in a controlled access section and make that section editable / not editable with a computed for display formula. Select "always expand" and hide the section title, so that nobody can collapse it, et voila.
Regarding your comment: With this properties:
for this section in designer:
You get this result:
You see: No twisty, no "visible" section

View data being cached/failing to refresh

I have a tabbed panel containing different sections of a form. In one section, users are given the ability to add a child document to the currently open document. In a second section, they are given a listbox, where the options are dynamically generated (via #DbLookup) by looking at a view of all the child documents, filtered by the current document's ID. This functionality all works correctly, however, there is a problem with the dynamic listbox options.
When a user adds a new child document, then switches to the next tab, the listbox is not updated with this new document. If they save/re-edit the main document or refresh the page, it makes no different, the user must load another XPage before going back to the original in order for the listbox to update. I have tried to resolve this by doing full updates of the page, using session.evaluate and "NoCache" in the #DBLookup call, or calling database.getView("My view").refresh(), but without luck.
There is also a similar problem where I have a repeat control which uses a view of child documents (again filtered by main document ID) as a datasource. When a user adds a child document using a button, it partially refreshes the repeat - but doesn't show the new child document until the page is refreshed again (or you leave the page and return).
Is there something crucial I am missing with regards to the JSF lifecycle/the way that view data is cached?
As first measure I would add another formula item to the listbox which simply returns the current time (#Now() should work). That way you can check if the listbox options are refreshed on the update in the first place.
If the options are refreshed fine it's indeed clear that the #DbLookup does some caching, although I'm not aware of any default caching logic.
At least for a test I would change the code to use a NotesView object instead of the #DbLookup, something like this:
var nview = database.getView("someview");
var nc = nview.getAllEntriesByKey(currentDocument.getDocument().getUniversalID(), true);
var a = [];
var ve = nc.getFirstEntry();
while (ve) {
a.push(ve.getColumnValues().elementAt(0)); // value of first column
ve = nc.getNextEntry(ve);
}
return a;
(I wrote the code from memory, there may be syntax errors).
Since the code only works with view entries it should be equally fast than the #DbLookup. And you could even do a nview.refresh() if needed.

Have to push button twice to get partial refresh to work

Background: Xpage with multiple data sources. Each row of tabbed table contains an edit panel bound to a different data source than the main page. Each page contains a table to enter new documents. These documents are children of the main document. There is a view control that shows the user created documents immediately. The button in the table saves the document in addition to adding some control fields. It does a partial refresh of the editPanel.
Recently I added validation to the fields in the entry table. I use a function, and prevent updating from anything but the button. I am using Tommy Valand's method from this blog post: http://dontpanic82.blogspot.com/2010/03/xpages-making-validation-behave.html. If I don't use Tommy's method, then the validators fire when switching tabs, and are useless.
All of this works sort of, but I am experiencing the following issues.
1) I have to push the button twice to get the partial refresh to fire. Not only that, but the validation messages to not fire until the button is pushed twice. The first part was still an issue prior to adding the validation.
2) The table values do not clear after the refresh does happen. This used to work prior to adding the validation. The only way to get the values to clear now, is to do a full refresh (F5).
I really just need partial refresh to behave like it should. Any help is greatly appreciated.
I am answering my own question because I think that I might have found out why the partial refresh was acting so flaky. Here is what I did that solved my issues: Each tab had an editPanel. If I make the edit panel do a partial refresh to itself then the buttons on that panel seems to behave as you would expect them to.
When I create a new core control panel, the default in No submission. I do not know whether this issue manifests itself only when using multiple data sources and/or tabbed tables. Hopefully this fix will be of use to someone down the road. It is worth a try if you are having issues with partial refresh working correctly.

Hiding Category when there are no documents xpages

I have an xpage with a categorized view and the first column shows categories that the user may not have access to see the documents underneath them. So they should be hidden from the view on the web. I am sure there is an easy way to do this using something like......
<xp:viewPanel value="#{view1}" var="rowData" id="viewPanel1" rows="50">
if (rowData.IsCategory()) {
if (rowData.(WHATEVER THE PROPERTY IS THAT SHOWS # OF DOCUMENTS FOR THE CATEGORY)) < 1 {
DON'T SHOW ROW
}
}
But I can't find the property for # of documents. Is there one? If not, then would you use a repeat control to handle empty categories? If that's the proper way to handle this, can you point me to some code example that would handle this using the repeat control. It's one of the trickier concepts for me right now. Thanks in advance.
There's a setting on the view itself (not the view panel, the actual view design element) to suppress empty categories. If you enable that setting for the view, any view panel bound to it should respect the setting.

wrong/crazy number display in xpages dynamic view

I have a crazy effect when displaying in view with a number column in a dynamic view panel of an xPage:
Some (not all!) entries are displayed like:
123.40000000000005
the value in the notes doc is 123.4 .
I cannot found any difference between that wrong displayed value and others, which are displayed correctly.
I tried a few number formatting things in the column properties of the notes view: does not improve.
the notes view displayed everything well (for the notes client).
Is it a bug? Or did a forget some format settings for the dyn view control?
Thanks in advance, Uwe
Its not a bug, more like a side effect.
Well because it is double, there is way to put floating point numbers in memory, sometimes it behaves "little bit strange" but its just a side effect. So there is sometimes small error in numbers.
read this: http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
it explains how floating point works.
regards
tmp:=yourfield;
#Round(tmp*100)/100

Resources