1
votes

I'm using a Dojo Data grid together with a REST service to display view data. When I double click on a row, an XPage is opened. My problem is that, if one of the columns in the grid is not sorted, the wrong XPage is opened. What could be the problem here?

<xe:djxDataGrid id="P_Alle_DDG" store="restService2"
styleClass="DojoViewTable" title="Pendenzen - Alle" autoHeight="20"
rowsPerPage="25" selectable="true" selectionMode="multiple" 
singleClickEdit="true" rowSelector="2" style="font-size:12pt"
escapeHTMLInData="true">
<xe:this.onRowDblClick><![CDATA[var idx = arguments[0].rowIndex;
var unid = restService2._items[idx].attributes["@unid"];
var url = 'Reparatur.xsp?documentId='+unid+'&action=openDocument';
window.document.location.href = url;]]></xe:this.onRowDblClick>

UPDATE: With the following JavaScript code the problem has been solved:

var grid = arguments[0].grid;
var index = arguments[0].rowIndex;
var item = grid.getItem(index);
var unid = item.attributes["@unid"];
var url = 'Reparatur.xsp?documentId='+unid+'&action=openDocument';
window.document.location.href = url;
1
I would think that the underlining view would need to be sorted for it to work at all. The sorting doesn't have to be one of the columns that you show in the grid. - Steve Zavocki
I have sorted all columns in the underlying view. The columns in the underlying view correspond with those displayed in the Dojo Data Grid. - user1358852

1 Answers

1
votes

Tony, try this method of opening the document. The code if very similar to yours, but the key difference is that I made a view column that contains the unid, I called it "docid". This works for me.

var grid = arguments[0].grid;
var index = arguments[0].rowIndex;
var item = grid.getItem(index);
var unid = item["docid"];
var url = "New_PO.xsp?doc=" + unid; 
window.document.location.href = url;