In our XPages view controls, we compute a search string (xp:dominoView - xp:this.search) based on dropdown fields on the page, which works great.
But we found that this search returns the results sorted by relevance, and we'd prefer them to be kept in the view's sort order (usually, the first column is sorted ascending).
So, in the Notes client's FT search bar, you can specify this by changing the "Sort results by" flag to "Keep current order (sortable)", and this is also available as URL parameter by adding "SearchOrder=4" - but what would be the correct addition/wording to apply this to a "SELECT" statement resp. the XPages search we use?
The view control has a couple of additional properties that you will need to set; sortOrder and sortColumn.
Also, I believe you need to make the sortColumn sortable on the actual view itself which is on the second tab of the Column properties, "Click on column header to sort".
<xp:dominoView
var="view1"
viewName="your view"
sortOrder="ascending"
sortColumn="your column name">
<xp:this.search><![CDATA[#{javascript:compositeData.searchFilter;}]]>/xp:this.search>
</xp:dominoView>
Related
A lotus notes application is using a view with a column which is not categorized but is having the Show twsitie when row is expandalbe property check and it also is listing some documents.
Column formula:
#If (Form = "fmProiect";
"P: " + txt_Proiect;
Form = "fmDocCRM";
txt_Subiect;
"" )
I'm trying to achieve the same thing in a view panel - having the above view as Data Source Domino View.
I tried to add some icons for the expand/collapse property:
<xp:viewColumn columnName="$6" id="viewColumn3"
collapsedImage="/2.png" expandedImage="/1.png">
But still the column isn't categorized. Is there a way I can achieve this?
Add the attribute indentResponses="true" to your xp:viewColumn. Then response documents can by collapsed and expanded.
Note: As you described in your question, you have in Notes Client view the column not categorized but you can make visible or hide documents behind a document in view. Those documents are "response documents". They have an internal item "$REF" with the document id of the parent.
I have a formA where I have a field '_author' which is of type Authors/Computed for display with value (#Subset($Updatedby;1)). I display information from formA on viewA. What I want to achieve is that documents that are created by you are only visible to yourself on viewA. I tried the following formula in viewA 'View Selection':
SELECT (form = "formA" & #UserName =_author). Even though I know that these two variables have the same values when I read it from the document's properties, the condition is not satisfied and I do not see a single document. If I delete everything after "&", the view shows all documents.
All is hosted on a server which handles users.
A handy workaround is to create a Page with an embedded view. This view is exactly like your view but has an additional first categorized (!) column with your field _author.
Put into embedded view's property "Show single category" the formula #UserName or #Name([CN]; #UserName) depending on how your categorized column _author is formatted. Show then always the Page instead of the view.
This way you avoid trouble with "Shared, private on first use" views and users see exactly their own documents only.
#UserName works in a special manner in selection formulas in views. In your case the view should be Private on First Use. Read further here: http://www-01.ibm.com/support/docview.wss?uid=swg21089773 .
Be aware that this lead to all sort of issues, e.g. when you update the design of the view users must remove the view manually to get the changes deployed.
I have a repeat control that is gathering its data from a view. Displaying in a table is one column from the view. These entries can be variable. For each entry in the repeat control I would like to have a couple of user editable fields (comments and checkboxes). Since the amount and names of entries are dynamic I think dynamic field binding is the way to go. The problem is I have been struggling with it for a few days and have gotten no where.
So in the repeat I have a computedfield displying the value of the column. I was thinking of making the field name for the comments field the value of the computedfield. The datasource would be the same, just the fieldnames would change and be based on the entries in the row.
The previous entries stackoverflow entries about dynamic field binding all list passing custom properties, I still haven't gotten my head around those.
If the value of the computedfield1 = "One" then the datasource/field name for the inputText1 = "document1.One", and if the computedField1 = "Two" then the datasource inputText1 = "document1.Two"
Is this even possible?
I'm a little confused by if you want these to be things you're setting to render at page load or if you want them to dynamically change based on user entered data, but I'll assume it's the former and give you an example.
If I'm iterating through a view in a repeat control, I probably have something like:
<xp:repeat rows="50" var="currRow" value="#{ViewName}" IndexVar="rowNum">
</xp:repeat>
Inside my repeat, I will put a reference to a custom class
<xp:repeat rows="50" var="currRow" value="#{ViewName}" IndexVar="rowNum">
<xc:dynamicRowBinding dataSource="#{currentDocument}">
<xc:this.binding1>
<![CDATA[#{javascript: currRow.getColumnValue("binding1");}]]>
</xc:this.binding1>
</xc:dynamicRowBinding>
</xp:repeat>
What this is assuming is that the document you're binding things to on the XPage is declared as currentDocument, and that there is a column in your underlying view that is calculating the desired field binding for the current row based on the properties and values of that document.
In the custom control, the following exists:
By defining dataSource and binding1 as properties within the custom control, they will be available as compositeData.
Thus, to bind a field using these components, we simply put the following definition in our custom control:
<xp:inputText value="#{compositeData.dataSource[compositeData.binding1]}">
</xp:inputText>
I hope this helps!
I would like to create a custom control which shows 3 columns,
column 1, value selected from checkbox (this is ok)
column 2, editable box , this is showing but not working 100%
column 3, a button to remove the row (still to be done)
So far:
After selecting the options, click "Create Rows" button and 1 row appears for each selected option.
Problem:
Only last value in editable box, is used, how can I get the value from each box ?
getComponent("inputText1").getValue() only shows the last value.
Example code is on this URL:
http://snipt.org/AAgd3
You bind the column values to array variables. Exercise 23 has a complete working example: http://www-10.lotus.com/ldd/ddwiki.nsf/dx/Tutorial-Introduction-to-XPages-Exercise-23
You just need to adjust it to the source/destination of your data. Let us know how it goes
If you want to bind them dynamically, you can also do this with expression language. It takes a bit of getting around in order to get the fields editable, but the way I've resolved it is to pass a calculated ID into a custom control, then using that for the binding.
For example: If I'm Working with a list of Unique Part Names, I may pass into my custom control a variable for a Comment. If I pass this in as fieldNameComment to my custom control, I can dynamically bind it to an inputText element through the following code.
I'm using a DominoDocument passed in as the dataSource.
Calling the Custom Control:
<xp:repeat var="CurrVal" value="#{DataSource}">
<xc:DynamicTableRow dataSource="#{EmissionsDocument}">
<xc:this.fieldNameComment><![CDATA[#{javascript:CurrVal+"Comment"}]]></xc:this.fieldNameComment>
</xc:DynamicTableRow>
</xp:repeat>
Inside the Custom Control:
<xp:inputText id="inputText5"
value="#{compositeData.dataSource[compositeData.fieldNameComment]}">
</xp:inputText>
As long as (for some reason) none of the string calculations are performed within the expression language syntax, this will yield an editable field. In my testing, if I tried to calculate a value by concatenating any strings, the field would be bound, but not appear as editable under any circumstances. If you want to bind directly to fields, this may be a good approach, but if you want to save your array and parse it through java, then Stephan's solution also works great Hope this helps!
Appended: Added repeat control to show iteration through the data source. Each iteration of the Data Source yeilds a value, CurrVal, to which the string "Comment" is appended. This creates a series of FieldNames based on the Values in the DataSource that are bound to inputs within the custom control called DynamicTableRow
I'm having this categorized view displayed in a view panel where the category column itself is not shown. Instead I'm displaying a combobox above the viewPanel where users can select from all the categories available (see screenshot below). The combo is bound to a scopeVariable and is refreshing the viewPanel onChange. The viewPanel has a computed categoryFilter reading from the same scopeVar. That all works nicely.
Now I also have implemented an additional wildcard (*) value in the selection list which (if selected) programmatically sets the cat filter to NULL. This way I'm forcing the viewPanel to show all entries. Again, this works fine, but with the drawback that now the view is showing empty rows where the category entries would be shown normally (in the screenshot you see empty rows above each entry, with 2 entries for the category "edcom GmbH" obviously belonging to the same category; those aren't separated by an empty row):
One way to at least hide those empty rows would be through means of css coding. But I would prefer those rows not being rendered at all.
Can this be done at all using a viewPanel, and how? Or do I have to use other controls like a repeat or a dataTable maybe?
Thanks in advance,
Lothar
One "hack" (an ugly one I admit) would be to change your categorization column from Firma to Firma:"--All--" or Firma:"*" and then instead of setting the category filter to NULL you set it to "--All--" (or "*").
The double category hits the indexer, but should do what you need.
Obviously there's no easy way. So meanwhile I'll stick to this css-style solution:
In the view panel und All Properties - data I set var = "entry". Then, under All Properties - styling I set a programatic value for the rowClasses property:
if(entry.isCategory()){
return "rowStyleHidden";
}
return "";
The style class "rowStyleHidden" hides those rows using
display: none;
Don't know yet how this turns out performance-wise, I'll have to observe this once I implement it in a copy of the real database.
You can also switch to a none categorized view, by having the viewname calculated based on the value in combobox.