Tuesday, June 16, 2009

Xpages: A Tabbed Panel UI, and remembering which tab you were on..

tabbedpanel

I kind of like the tabbed panel as a UI for some applications, it seems to lend itself to being able to show more information horizontally than a navigator on the left hand side.  Now in my xpage application, i have a different view on each tab.  When you click on a document link it takes you to another page(the PO Form), and when you leave that page(the po form) the brwoser returns to this page, the tabbed panel. 

To get back to the tab the user was on before they opened the po…

First i set the “Tab opened by default” to a computed value that = sessionScope.whichtab

Next i set a session variable whichtab to the tab id(the id on the properties of the tab) in the on click event.

setvariable

Now every time you return to this page, or it refreshes, it will open the last tab that was clicked.

Tuesday, June 9, 2009

Xpages: View Picklist example download - now unencrypted!

Sorry, forgot about the default local encryption, I updated the Designer Wiki(could not delete the first attachment though), also it has been placed below for a direct link to the updated file. Thanks Sean for getting me set up.

Picklist Example Download

Monday, June 8, 2009

Xpages: picklist example download, can someone host the file for me?

I have had several request for a download of the code used in my picklist example. I have a very simple database with the code in it, but don't have a public place to post it. Can anyone help me out? thanks

here is a link to the download on the Designer wiki

link

Tuesday, May 19, 2009

Xpages: Picklist Views and the pager

If you create a picklist from a view like i posted yesterday, make sure you set the pager to partial refresh on your views, or else it will refresh the entire page and your dialog will go back to being hidden.



Monday, May 18, 2009

Xpages: How to create a view picklist!!

So i finally figured it out, by piecing many sources of code from around the internet.


Updated to say go get the custom control on Openntf.org!!!
It is much easier to use and set up.  It is also reusable.


Step 1. create a custom control.

Create a custom control and put your view on it, and put a search bar and a select button above it like this, make the first column have a check box option


Configure this for searching.... click here if you do not know how to do this.

On the select button "on click" event put this code in, it gets the selected documents, then it gets a value from the document and then adds it to the field on my main form. I got this code form the developer wiki

function printToLog(stuff) {
_dump("\r\nPRINT START\r\n");
_dump(stuff);
_dump("\r\nPRINT END\r\n");
}

var database = session.getDatabase("notes1", "applications\\viewpoint.nsf")
var viewPanel=getComponent("viewPanel1"); //get the componet of viewPanel
var docIDArray=viewPanel.getSelectedIds(); //get the array of document ids
printToLog('got ids')

for(i=0;
i  <  docIDArray.length;
i++){
var docId=docIDArray[i];
printToLog(docId)
var doc=database.getDocumentByID(docId);
printToLog(doc)
if(doc != null){
var pickthis1 = doc.getItemValueString("projectnum")
printToLog(pickthis1)
}
}

if(pickthis1 != null){
dominoDocument1.replaceItemValue("job", pickthis1)
}


On the client side of the select button js on click event, enter this in
dijit.byId('Dialog3').hide();


This closes the dialog we will create in a moment. Save and close that custom control.

On your main form you need to add this client side javascript function, i found this on the forum, unless you use this you can not click any buttons on your dialog or search or update.
/**
* Creates a dijit dialog box based on a div content
* @param id div identifier
*/

function dialog_create(id, title1) {
var dialogWidget = dijit.byId(id);
if( dialogWidget )
dialogWidget.destroyRecursive(true);
dialogWidget = new dijit.Dialog(
{ title: title1, duration:600},
dojo.byId(id));

var dialog = dojo.byId(id);
dialog.parentNode.removeChild(dialog);

var form = document.forms[0];
form.appendChild(dialog);
dialogWidget.startup();
}


Next add this to the source of your page, notice the<> is the picklist custom control we just created



At the top of the XPage in source view, you need to add the onload function to call the function to create the dialog

Then we create a button to show the dialog with client side javascript.
dijit.byId('Dialog3').show()

Then you will have something that works like a picklist, once you do it once it gets much easier.

moz-screenshot

example

Thursday, May 14, 2009

Xpages: Has anyone created a picklist yet?

I was wondering because it would be nice to have a button to pop up a dialog with a view in it, have check boxes and be able to return values back to the underlying webpage when done.

I have created a dialog inside an iframe for a simple pop up form, so i am familiar with that step. I guess i could put an xpage view inside the dialog and then when the select button is pushed, transfer the values, but how would one get the values of the selected document?

Any help is appreciated, this seems to be the only big thing missing from xpages, and maybe they will add an @picklist function in the future

Tuesday, March 31, 2009

Xpages, file download control problems, work around

It seems that if you put a file download control on an xpage, and that application is in a sub folder,
ie. data\applications\application.nsf

then you will receive an error trying to open the files. The developer evidently forgot to get the path of that database when creating the link.

Work Around:
It you put the same database in the data directory it works great.

Don't know why this has not been fixed seems like it would be simple, with a feature release.