PDA

View Full Version : Handle rowdblclick on uiview with b2r2


NicolasAlpix
08-18-2009, 10:00 AM
Hello,

I have update from extnd b1r1 to b2r2, and i have write some handle like:


view2 = new Ext.nd.UIView({
viewUrl : viewurl,
count:10000,
showActionbar:false,
toolbar:false,
gridConfig: {
renderTo : tmp,
//to take all place of the contener
autoHeight: true,
autoWidth: true,
collapseFirst:true ,
collapsed :true,
decimalPrecision: 2
}
});
view2.gridHandleRowDblClick = addDoc;
view2.getValue = getValue;
view2.gridHandleRowContextMenu=gridHandleRowContextMenu;



But with 2br2 it don't work, view2.gridHandleRowDblClick, do nothing.

So i try to :

view2 = new Ext.nd.UIView({
viewName : nameofview,
count:10000,
title:false,
gridConfig:{
renderTo : tmp,
//to take all place of the contener
autoHeight: true,
autoWidth: true ,
listeners:{rowdblclick:addDoc,rowcontextmenu:gridHandleRowContextMenu},
openDoc:function(){}
}
});


my function addDoc work, but this comportement of rowdblclick ie open the doc to an other window, is still working.

Therfore my question is:

how to use gridHandleRowDblClick with extnd_b2r2 , in order to open doc in a new tab, instead of a new window ?

NicolasAlpix
08-19-2009, 02:39 AM
Hello,

so my function:


function addDoc(grid, rowIndex, e, bEditMode) {
var mode = (bEditMode) ? '?EditDocument' : '?OpenDocument';
var title = "Opening...";
var ds = grid.getStore();
var row = grid.getSelectionModel().getSelected();
var node = row.node;
var unid = node.attributes.getNamedItem('unid');
// if a unid does not exist this row is a category so bail
if (!unid) {
return;
} else {
unid = unid.value;
}
var panelId = 'pnl-' + unid;
//name of current view from object Ext.nd.UIView
var viewName=this.viewName;
var link =""
var viewUrl="";
viewUrl=this.viewUrl;

if(viewUrl==""){
//url of current window
var pathArray = window.location.pathname.split( '/' );
var newPathname = "";
var i=0;
var srttmp=pathArray[i];
while(!srttmp.match("\.nsf")){
newPathname += pathArray[i];
newPathname += "/";
i++;
srttmp=pathArray[i];
}
link=newPathname+srttmp+viewName+"/"+unid + mode;
linkedit=newPathname+srttmp+viewName+"/"+unid+"?EditDocument";
}else{//viewUrl existe view other database
link=viewUrl+"/"+unid + mode;
linkedit=viewUrl+"/"+unid +"?EditDocument";
}
title= viewName;


var win = new Ext.Window({
width:400
,id:'autoload-win'
,height:300
,autoScroll:true
,title:title
,autoLoad:{url:link}
,tbar:[{//ajout d'une barre d'outil
text:'Editer'//recharger le document en mode edition
,handler:function() {
win.load(linkedit + '?' + (new Date).getTime());
}
},
{
text:'Sauvegarder'
,handler:function() {//pour savegarder il faut renvoyer le formulaire en post
formnumber=document.forms.length - 1;
popup_window =window.open("popup.html","pop1","width=200,height=200");
document.forms[formnumber].target="pop1";
document.forms[formnumber].submit();
popup_window.close();

//rafraichir le panel courant
var panel_courant = mainPanel.getActiveTab();
mainPanel.remove(panel_courant,true);
addTabViewOtherDb(title,viewUrl);
}
}

,listeners:{show:function() {
this.loadMask = new Ext.LoadMask(this.body, {
msg:'Loading. Please wait...'
});
},

render: function() {win.body.on({click:{delegate:'a',
fn:function(event,anchor){
event.stopEvent();
anchorId = anchor.id;
anchorHref = anchor.href;
anchorName = anchorId.replace(/-/g,'_'); // IE does not like dashes
anchorClassName = anchor.className;


if(anchorHref.match("Section")){document
win.load(anchorHref);
}else{
if (anchorHref.match("FILE")){
newWindow = window.open(anchorHref,anchorName)
}else{
openLink(anchorHref,anchorName);
}
}
//if (window.focus) newWindow.focus();

}} })}
}

});

win.show();
}


So this code work when call to gridHandleRowDblClick liteneur on extnd B1r1 but doesn't on B2r2, is there any change to the source of extnd/3x/source/domino/UIView.js since extnd/2x/source/domino/UIView.js?

The probleme is whem i double click on a row, both my code and the framwork code is launch with listeners:{rowdblclick:addDoc} to the gridconfig on the uiview.

my previous code : view.gridHandleRowDblClick=addDoc don't work any more on B2r2.

Anyone have some idear ?

NicolasAlpix
08-19-2009, 03:46 AM
;) Hello finally i find !

in override directly the openDocument method like:

view2.openDocument=addDoc intead of view2.gridHandleRowDblClick=addDoc it work.


Thanks to all who have waste his time in order to help me

jratcliff
08-19-2009, 08:27 AM
So what were you trying to do? Were you just wanting to have a doc open in an Ext.Window?

NicolasAlpix
08-19-2009, 08:41 AM
When i open an entry from a grid of one uiview ?

But now it work it do something like in the picture: window.jpg


In an other hand i have rewrite the method getValue
from extnd/2x/source/domino/UIView.js

and modify: case 'number':
if (tmpValue.indexOf('.') > 0) {
var num = new Number(tmpValue);
tmpValue = num.toFixed(2);
}else{
tmpDate = tmpValue;
}
break;

But with now extnd_b3, with an view=Ext.nd.uiview object, a call to view.getValue

give me an erreur as: value.data not defined.

Can i have the source of extnd/3x/source/domino/UIView.js in orderto see how can i resolved this other probleme ?

Thanks a lot

jratcliff
08-20-2009, 10:59 AM
In Beta 3, take a look at the main-complex2.html page. In the example, I have all docs open in a new Ext.Window instead of a tab by setting target to the id of the Ext.Window and then adding a 'beforeopen' listener on the view that creates and opens the window with this id. Since this listener does NOT return false the normal dbl click executes but since it has a 'target' specified, it opens the doc there instead of the tab.