On view columns you can set them to sort ascending, descending, both, or 'change to view'. Today, I figured out a way to get 'change to view' working in DWT. It may not be the most efficient way so I'll research some more to see if there is a better way to do it. Also, I don't have this feature in the latest (0.2.1) code on OpenNTF so if you can't wait till later next week for me to post 0.2.2 then keep reading and I'll explain how to modify the code to add this feature.
OK, first, if you want to see it in action take a look at the online DWT demo and open the example1 flat view. If you click on the subject column heading you will find that it takes you to the example 2 flat view. Now one "bug/issue" is that the view title doesn't change at the top. The view, did in fact change, its just that view?ReadDesign doesn't tell me the name of the view that the 'change to view' option is set to. All it tells is the UNID of the view. This is really an IBM/Lotus bug and I'll see if I can get someone at IBM to SPR this. In the meantime, I'll have to figure out a work around.
Ok, enough of the demo, I'm sure some of you you may want to have the code to at least get the 'change to view' option working and just can't wait till the next release. First, in the dwt.nsf database, open the dwt/widget/DominoUIView.js Javascript library. Then, look for these two lines of code:
this.grid.addListener('rowdblclick',this.openDocument, this, true);
this.grid.addListener('keydown',this.gridHandleKeyDown, this, true);
Next, add this line of code right after the other two lines
this.grid.addListener('mousedown',this.gridHandleMouseDown, this, true);
Finally, at the bottom of this JS file, add this block of code:
DWT.widget.DominoUIView.prototype.gridHandleMouseDown = function(e) {
var node, unid;
var header = this.grid.getHeaderFromChild(e.getTarget());
if (header) {
var col = header.columnIndex;
var colConfig = this.cm.config[col];
if (colConfig.resortviewunid != "") {
// delete the current grid
if (this.grid) {
this.viewPanel.setContent("");
try {
this.grid.destroy();
} catch(e) {}
}
// now display this new view
this.grid = new DWT.widget.DominoUIView({
layout : this.layout,
viewUrl : colConfig.resortviewunid,
viewParams : "",
viewPanel : this.viewPanel,
statusPanel : this.statusPanel
});
}
}
};
So what's happening here is that the grid (our view) is now listening for mouse down events (maybe I should listen for click instead??) and when one happens, it checks to see if it happened on the header. If so, it checks to see if that header has the 'change to view' option set (that's the colConfig.resortviewunid property). If it does, it removes the current view and opens the new view. Piece of cake, right?
Anyway, if you need this feature now, then put this code into your version of the DWT and I'll continue to do some more research to see if there is a better way to handle this and I'll see about figuring out the actual name of the view based off just it's UNID so that we can have the title of the view pane updated.