Action Button works differently if added to the DataView - xpages

I have a button that calls a Dialog that has a combo box bound to a sessionScope variable. The combo box contains a list of form names that I use to then call an XPage to create a new document. The first value in the forms list is "" so the user needs to select a value. I have a button with the onClick event of:
var c = getComponent("CreateDocDialog");
sessionScope.put("ssSelectedForm","")
c.show();
I have the button and dialog on a customControl with a repeatControl and when the button to open the dialog is clicked the ssSelectedForm is null and the current value of the combo is blank, which is exactly what I want it to be. However, if I add the same button and dialog to a customControl with a dataView control the dialog displays but ssSelectedForm is not null so the combo box displays the last value of ssSelected. I have placed the button outside the dataView, in several of the facets on the dataview, but all with the same results.
Very confusing.

Bill,
I am going to answer the same as my comment since I am pretty confident about what I said.
Go ahead and change the scope from sessionScope to viewScope. I had a similar issue once, and I 'fixed' it by clearing out the sessionScope variable after I used it. This worked, but I realized that it was not necessary, and that by changing to viewScope the lifecycle will be shorter and there was no need to clear out the value when I was done with it.
I don't know why this fails when added to the data view, but if this fixes it that would be all that matters.

Related

Partial refresh after OK in name picker control

how can I establish a partial refresh after I select the OK button in the xe:namePicker control ?
I only have the for property which does copy the selected value in the assigned field.
The onchange event for that field does not always seem to recognize the value change.
Instead of an Edit Box, I would recommend using Dojo Name Text Box, as covered here. It avoids the need for validation - with an Edit Box even though you provide a Name Picker, users can still enter values manually and can edit them after selecting from the name Picker. The Dojo Name Text Box and Dojo List Text Box are the only controls I use with pickers and almost always use onChange with them, without issue.
One caveat is that the Events tab defaults to onClick. On more than one occasion I've coded onClick instead of onChange, but it's easily identifiable and rectifiable.

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);

viewpanel selections being unselected on dialog box show

I have an extension pages dialog box on the same page as a viewpanel that has check boxes enabled. If I check some check boxes then show the dialog box, the selections in the view panel become unselected. Is anyone else seeing this?
I have the same issue and it looks like we're trying to do the same thing. I plan to add the selected IDs to a sessionScope, update their values, then remove the sessionScope.
I found this one, so I'll update here to see if it works: get the unid of selected documents and save to scoped variable
UPDATE:
I got it to work by setting a sessionScope variable for the selected IDs, as in the above example:
sessionScope.put("SelectedIds", getComponent("viewPanel1").getSelectedIds());
In the SSJS script, I changed the code to read the sessionScope array instead of the viewPanel's selections.
Fortunately, the IDs are very small (3 characters), so if there are a lot of documents, it should be ok.
Good luck!

How to modify EditField value on CheckBox action in InstallShield

I have EditField (it has global property EDITPROP) on the same window I have checkBox. I want to midify text that is visible in EditField when I check CheckBox.
I create action that modifies this property (EDITPROP) and run it on CheckBox click (as and DoAction). But when I click on CheckBox, I cannot see any changes in text on EditField.
What should I do in order to show this updated text on the EditField ?
It's an MSI limitation that while EDITPROP will have the selected value as defined in the CheckBox table, and UI elements using it ( [EDITPRO] ) won't refresh until you call NewDialog to go to the next dialog. A work around for this behavior is to use ControlConditions to show/hide two mutually exclusive Text controls that use static text to represent the selected and unselected state.

Resources