Xpages - dijit.Dialog HOWTO pass a parameter

Hello everyone,i’m opening a dijit.Dialog from an Onclick event on a column in a View Control.

There is a View Control displaying a view data, I’d like to open the details of the row in a dijit.Dialog popup.

The popup is opening fine.

What I’m not able to do is just pass the column value to the dialog.

(imagine the view’s showing a list of articles, and the popup should display the details of the clicked article).

Thank you very much for your help,I’m new with dojo and I have no idea on how to get this working!

Marco

Subject: working solution

Hi,

you can solve this problem by checking the checkbox (which is hopefully in the data row) with dojo. Then you can show your dialog and if you have a table in your dialog you could put an event on this table (onmouseover), which gets the data you want to show by executing a server side js, which can use the noteid now.

If you do that you have to set a flag because if you’re not doing that, the table refreshs every time (onmouseover-event).

And yes, i know that this is a pretty dirty solution but it works :slight_smile:

Cheers

Subject: …

Hello Benjamin!,thanks for your interest!

In this solution the user must first click on the checkbox and then click on the link? did i understand this right?

The workaround you suggested is not fine for me because I want to open different Dialogs in several columns, every column should open a different popup…

It could be interesting if the checkbox will get checked automatically from the click event in the columns! This will result transparent to the end user!

Do you think it is possible ?

Thanks agin for your interest!

Marco

Subject: check box automatically

Hi,

i meant that you can check the checkbox automatically.

To do this, you can use dojo.

You have to get the dom node then you can check the box.

e.g.:

//get the node you want (“domnode” represents the table row in this case)

box = dojo.query(domnode).query(“input”);

//then check the box

box[0].checked = ‘checked’;

Subject: Open an xpages in dijit.Dialog

We did exactly as you are trying to open a dijit dialog by clicking on an icon in the view column from viewpanel. The dialog is displaying document in an xpage perfectly. However, all buttons are idle and no action fire. Here is the code below. By the way, are buttons in your dialog working? If so, please let us know how they works. Big thanks.

dojo.require(“dijit.form.Button”);

dojo.addOnLoad(function(){

//first check if it’s there so we don’t create a duplicate

var dialog = dijit.byId(“fieldProfileDialogId”);

if (dialog) { dialog.destroyRecursive(); }

var url = “xpFormFieldProfile.xsp” + “?documentId=” + “#{javascript:rowFieldProfile.getUniversalID()}” + “&action=editDocument”;

// create a “hidden” Dialog till calling show it

var dialog = new dijit.Dialog({

title:“Field Profile”,

href: url,

refreshOnShow: true,

preventCache: true

},

dojo.byId(“fieldProfileDialogId”)

);

// showe the dialog box

dialog.show();

});

Subject: i tried with session variable: no working

I’ve already tried to put the column value in a sessionScope Variable,but seems as when the popup’s open that variable change its value to the last value of the datacollection…

this is the script i’m using in the column value:


var strc = String.fromCharCode(34);

val = s.getColumnValue(“name”);

sessionScope.put(“hh”,val);

"<a href= " + strc + “#” + strc + “onclick=” +strc +

“dijit.byId(‘picklistDialog’).show();dojo.style(dijit.byId(‘picklistDialog’).domNode,‘opacity’,1);” + strc+“>” + val + “”;


The point is when i’m using this script:


c = sessionScope.get(“hh”);

“<a href= " + strc + “#” + strc + “onclick=” +strc + “c='” + c + “'; alert(c);” + strc+”>" + val + “”;


the alert is getting the right value, the one in the row i clicked on.

Please,any help’d be much appreciated… i’m stuck.

Thanks a lot

Marco