3.0.5

trigger function on mouseclick

Can I trigger one function, or fire an hyperlink, on mouseclick in every tables's row?
Thank a lot.
mickey
September 21,
Look in the event handling in case of a contextmenu. The mouseclikc goes in a similar way.

Active.Templates.Text.prototype.setEvent ("oncontextmenu", oncontextmenu );
Active.Templates.Text.prototype.setEvent ("onclick", onclick );

openmodelinggrid = Active.Controls.Grid.subclass();

openmodelinggrid.init = function () {
var obj = this.prototype;
this.inputsprocessed = false;

/* function to hide the contextmenu parent is the object who needs the grid */
obj.setAction("click", function(e) {
if (this.gridactionDOM) {
this.gridactionDOM.style.display = "none";
//reset height of grid after hiding the action pane
this.resetgridheight ();
}
if (this.parent && this.parent.page) this.parent.page.hidemenu (this.getOpenmodelingProperty ("currentevent"));
});

obj.setEvent("onkeydown", function(e) { // in case you want key handling
this.trapkey (e);
});

obj.defineStatusProperty("text", function() {
var creturn="";
switch (this.getStatusProperty("code")) {
case "loading":
return showmessage(285,this.parent.language); //Loading data, please wait...
case "nodata":
creturn = this.displayentitycount (this.parent);
if (creturn != null) {
return (creturn);
} else {
return showmessage(284,this.parent.language ); //No data found
}
default:
return "";
}
});

// workaround for model proxy bug
obj._DataProxy = null;
obj._RowProxy = null;
/*****************************************************************
openmodelingproperties
*****************************************************************/
obj.defineModel("openmodeling");
obj.defineOpenmodelingProperty("contextmenu", true );
obj.defineOpenmodelingProperty("titlebar", false );

obj.defineOpenmodelingProperty("searchfilteraddavailable", false );
obj.defineOpenmodelingProperty("dragavailable", true );
obj.defineOpenmodelingProperty("currentevent", null );
obj.defineOpenmodelingProperty("columndata", new Array () );
obj.defineOpenmodelingProperty("maxrelation", parseInt ( session ("maxrelation") ));

// based on the length of the fields defined in database a width on the screen is determined
obj.defineOpenmodelingProperty ("lengthmultiplier", 2.0 );
obj.defineOpenmodelingProperty ("contextmenuvisible", false);
obj.defineOpenmodelingProperty ("doubleclick", false);
// possible values add search filter
obj.defineOpenmodelingProperty("mode", null );
}

openmodelinggrid.init ();

function oncontextmenu (e) {
if (this.setOpenmodelingProperty && this.getOpenmodelingProperty("contextmenu")) {
e.cancelBubble = true;
e.returnValue = false;
this.setOpenmodelingProperty ("currentevent", e);
this.setOpenmodelingProperty ("contextmenuvisible", true);
if (this.action) this.action ("contextmenu");
}
}

/*
* Capture the event
*/
function onclick (e) {
e.returnValue = true;
e.cancelBubble = false;
if (this.setOpenmodelingProperty) {
this.setOpenmodelingProperty ("currentevent", e);
if (this.action) this.action ("click");
}
}

September 21,

This topic is archived.

See also:


Back to support forum