Select All checkbox lotus xpages - xpages

I'm working on an Xpages application on which I have a view control.
I tried to put a checkbox in the column header to select all of the check boxes in the view.
The problem is when I go to another page from the view, its lines are not checked and the selection is made only on the visible page.
So, I want to be able to select all the rows in all the pages of the view, this without the selection disappears when switching from one page to another of the view.

There are couple of problems with views and selections.
First of all, pager actions to move between pages does not process 'select all rows' data because it is enabled to use partial execution by default. If you put partialExecute="false" into your pager, you will see that 'select all rows' checkbox will be maintained between pages.
However, if you have a checkbox on a column and the columnHeader, the component maintains a selectedIds array in the back-end. Unfortunately, this array holds only visible selections. Because the array is maintained by the viewPanel component, which is not aware of the list of data entries that are not shown.
Also, checkbox implementation does not provide any even mechanism where you can grab selections on the back-end to cache them between pages.
To determine select all checkbox can be doable with a little trick. Assuming you are using all default styles;
<xp:inputHidden
id="inputAllSelected"
value="#{viewScope.allSelected}"
defaultValue="false"></xp:inputHidden>
<xp:scriptBlock
id="scriptBlock1">
<xp:this.value><![CDATA[
function getSelectAllCheckbox() {
return dojo.query("input.xspCheckBoxViewColumnHeader")[0];
}
function toggleSelectAll(){
dojo.byId("#{id:inputAllSelected}").value=getSelectAllCheckbox().checked;
}
dojo.addOnLoad(function() {
dojo.connect(getSelectAllCheckbox(), "onchange", toggleSelectAll);
});
]]></xp:this.value>
</xp:scriptBlock>
To cache checkboxes between pages, you would implement your own checkboxes by using custom columns. I recommend using a data table component to get more flexibility.

Related

Force user to select only one value from filter spotfire

Is it possible to force the user to select only one value from a filter ?
For a radio button filter as below, is it possible to remove the buttons all & none and make sure that only one Choice is selected ?
you cannot change the existing filter features or functionality without developing a custom extension for a new filter control.
that said, you can certainly emulate a filter using what's called a Property Control and a Data Limiting Expression. for single selection, you're stuck with either a Dropdown control or a Listbox (single select) control.
you would need to...
create a Text Area Visualization on the page somewhere
insert a Listbox or Dropdown Property Control into the Text Area Visualization
create a Document Property with the same data type as your filter column and associate it to the Property Control. you can set this to Unique Values in Column or write in your own Fixed values.
open the Properties dialog on the visualization you'd like to filter and navigate to the Data page
scroll down to Limit Data Using Expression and use an expression like [MyFilterColumn] = "${MyDocumentProperty}" (quotes are required for string values; if numeric then omit quotes)
Please add this CSS in the HTML page of the spotifre to remove all and none
.ColumnFilter .sf-element-filter-item:last-of-type { display:none; }
.ColumnFilter .sf-element-filter-item:first-of-type { display:none; }
Another way to force the users to select one option is to add a Show/Hide in the visualization like this: Hide if UniqueCount([Field]) is greater than 1

Xpages chained djFilteringSelect in separate dialogs

I am trying to make a 2nd djFilteringSelect using a #Dbcolumn depending on the value selected in the 1st djFilteringSelect control. That's a common task, using a partial refresh. However, each of the controls is within a dialog control from the extension library. One dialog pops up, the user selects a value, and automatically the 1st dialog closes and the 2nd opens. YOU CAN'T SEEM TO REFRESH THE FIELD (I'm guessing b/c it's not in the DOM). I've tried writing the first value to to an computed field and/or a text box on the main Xpage using CSJS and then looking for that value for the second lookup. Also, tried with SSJS, etc. I tried do updates and writing to fields on either the onChange or on the click of button. How do I go about using the selected value of the first to do the lookup in the 2nd?
You can use a single dialog control where you hide and show the relevant controls. I am using this approach in several apps.

How to mark a multiple selection on a DataGrid control?

I've got a custom control based on a Datagrid. What I want to achieve is doing multiple selection of rows and then right click on the row selector to open a context menu.
What actually happens: Selection of multiple rows works fine until the user right clicks on the row selector. Once that is done, there is only one selected row the one over which the right mouse button was clicked.
What I need to happen: Allow the user to do a multiple selection (rows have a style for selection) and right click to open the context menu without loosing the previous selection.
What do I need to do?
No it doesn't happen like that at all. Make sure that you have DataGridView MultiSelect property set to TRUE. Then assign your ContextMenustrip control to the datagrid's ContextMenuStrip property.
That should do the work and multiple selection should remain on right mouse click as well unless in your code behind somewhere you are altering that.
In which case, you will have to debug and find out where and how.
Just revisited the code and found that I was not updating the SelectedItems IList:
Dispatcher.BeginInvoke(new Action(delegate
{
foreach (var item in e.RemovedItems)
{
SelectedItems.Add(item);
}
SelectedItemsList.Add(SelectedItem);
}), System.Windows.Threading.DispatcherPriority.ContextIdle, null);

Lotus xpages: xpage containing multiple views

I have a xpage which contains one big table with 1 row and 2 columns. I created this table to separate the xpage into 2 parts: the left one where I have some buttons and the right one where I want to display some views.
From the container controls I drag a View on the right column, but is there any chance to do this in such a way that 1st button clicked => 1st view is shown, 2nd button clicked => 2nd view is shown and so on.
Or every xpage should contain one view?
I raise this question considering the fact that in Lotus Notes if you had one frameset with 2 frames, you could easily create an outline in one frame, and some views that will be open by every outline entry in the 2nd frame. What I want to do is quite the same thing.
I appreciate your time. If you think this question isn't 'good' enough, I will just delete it. I'm new in XPages development.
Use simple table with one row and two columns. Place your buttons inside the left cell. Put the switch control (mentioned by Tim) to the right one.
More about the control in extlib demo DB... online demo here
Create separate custom control for each view and drag and drop "Include Page" from container control to the right column of your table and compute the page name instead of selecting an XPage. You can compute like this sessionScope.CCName + ".xsp". And onclick of the button set appropriate custom control(which contains the view) name as the value to the sessionScope variable and reload the page. This will do what you want. I hope this too helps.
You could do this on a single XPage using a xe:navigator control in the left column and an xe:dynamicViewPanel control in the right. These controls are available in the Extension Library if you are running 8.5.3 and natively available in release 9.
The Dynamic View Panel control is the dynamic content control for displaying one of several Domino views. Only the component for the displayed view is loaded in the component tree so it is highly efficient compared to alternative designs (like an xp:viewPanel control in each facet of an xe:switchFacet control as each viewPanel is loaded in the component tree on the server, not just the one that is rendered).
See this online demo http://xpages.jp/demos/xpagesext.nsf/Domino_DynamicView.xsp
put each content on a seperate panel in a custom control.
Have those custom controls in seperate divs and show/hide divs based on button click.
If you are using different xpages, you can use IncludePage(from container controls), which will act like a computed subform.

XPages - Value Picker - Update Multiple fields

I would like to use a dominoViewValuePicker to update several fields with several values. I have seen that it is possible to add multiple values to the one field. Is it possible to select one document from a dominoViewValuePicker and then use multiple values from this document to update multiple fields on the XPage?
Certainly. Just set the onChange event to refresh those fields (preferably, they all go into a panel so that you can do a partial refresh rather than a full refresh) and compute the values (either from the script on the onChange or just by the formulas for determining those values in the first place).
If you do set up a panel for a partial refresh, make sure to give the panel an ID. By default panels are not given ID's and are not available to refresh.

Resources