Skip to main content link. Accesskey S

The useful resource for IBM Lotus Domino XPages development

Submit Search


Home > UI > How to create a picklist style dialog
xpageswiki.com
is maintained by 
Julian Buss.
You can hire me.

How to create a picklist style dialog

Found in Mark Hughes Blog:

- Create a custom control with a panel, a view inside the panel and other componets as you like - this control will become the dialog. Set for example "picklistDialogPanel" as name for the panel and "picklistView" for the view.
- In the view, make the first column have a check box option
- put a button somewhere, in the onclick event use code like this as server side js:

var viewPanel=getComponent("picklistView"); //get the componet of viewPanel
sessionScope.put("pickledIds", viewPanel.getSelectedIds()); // store ids of selected documents in a sessionScope variable


- and use this client side js in the button:

dijit.byId('picklistDialog').hide();


- Go to the source of the custom control, find the "<xp:panel id="picklistDialogPanel">" string and wrap a div with the id "picklistDialog" around it like this:

<div id="picklistDialog" style="display:none">
<xp:panel id="picklistDialogPanel">
....
</xp:panel>
<div>


- Include that component on your XPage
- Put this function in some client javascript library and include that library in your XPage

function dialog_create(id) { 
  var dialogWidget = dijit.byId(id);
  if( dialogWidget ) dialogWidget.destroyRecursive(true);
  dialogWidget = new dijit.Dialog( { }, dojo.byId(id)); 
  var dialog = dojo.byId(id);
  dialog.parentNode.removeChild(dialog); 
  var form = document.forms[0]; form.appendChild(dialog); 
  dialogWidget.startup(); 
}


- In the source of your XPage, put somewhere at the bottom this kind of code:

<script language="javascript">
XPS.addOnLoad(function() {dialog_create("picklistDialog")});
</script>



- To show the dialog, place this client javascript on some button or link or something else:

dijit.byId('picklistDialog').show()



This shows the dialog and after the user dismisses the dialog the Note-IDs of the selected documents are stored in the "pickedIds" sessionScope variable.

See Mark Hughes Blog for some screenshots and code variations.
Created by Anonymous on May 20, 2009 12:38:46 AM

XPS or XSP?


Created by Anonymous on Jun 4, 2009 9:58:45 AM

Yes correct.It think It should be XSP.


Created by Anonymous on Sep 16, 2009 2:20:53 PM

I noticed that when i create a response document, the view in the picklist doesn't have any content. Is there a solution for this problem?

Thanks


Created by Julian Buss on Oct 12, 2009 9:49:42 AM

perhaps a wrong setting in the Notes view properties... there is a setting "show response document in a hierarchiy", that has to be turned off.


Created by Anonymous on Oct 20, 2009 10:31:33 AM

unfortunately that isn't the cause. but thanks for your answer


Created by Beau Schless on Jul 21, 2011 6:05:42 PM

when setting up the library

dialogWidget = new dijit.Dialog( { }, dojo.byId(id));

returned an error


Add Comment

Name:
Comments:
How to take your XPages App to the iPhone, iPad, Android: use Domino To Go!
Do you look for an XPages Workflow solution? Take YouAtNotes Workflow.