PDA

View Full Version : [CLOSED] Hyperlink Client API?



jwf
Aug 21, 2012, 7:04 PM
Hi,

Where is the client-side API for the ext.net Hyperlink class? Through searching I was able to find another forum post detailing the client method setUrl, but I could not find a list of members/methods/events in the sencha api. Is this available anywhere?

Daniil
Aug 22, 2012, 4:48 AM
Hi,

Unfortunately, we have no docs for HyperLink.

Here is the full sources. The valueElement function is private and should not be used by a developer.

The destination of the rest methods and its arguments should be understandable. Please ask if you have any questions.

HyperLink


Ext.net.HyperLink = Ext.extend(Ext.form.Label, {
cls : "",
url : "#",

valueElement : function () {
var textEl = document.createElement("a");

textEl.style.verticalAlign = "middle";

if (!Ext.isEmpty(this.cls, false)) {
textEl.className = this.cls;
}

textEl.setAttribute("href", this.url);

this.textEl = Ext.get(textEl);
this.textEl.setOverflow = Ext.emptyFn;

if (this.disabled) {
textEl.setAttribute("disabled", "1");
textEl.removeAttribute("href");
}

if (!Ext.isEmpty(this.target, false)) {
textEl.setAttribute("target", this.target);
}

if (this.imageUrl) {
textEl.innerHTML = '<img src="' + this.imageUrl + '" />';
} else {
textEl.innerHTML = this.text ? Ext.util.Format.htmlEncode(this.text) : (this.html || "");
}

return textEl;
},

setDisabled : function (disabled) {
Ext.net.HyperLink.superclass.setDisabled.apply(thi s, arguments);

if (disabled) {
this.textEl.dom.setAttribute("disabled", "1");
this.textEl.dom.removeAttribute("href");
} else {
this.textEl.dom.removeAttribute("disabled");
this.textEl.dom.setAttribute("href", this.url);
}
},

setImageUrl : function (imageUrl) {
this.imageUrl = imageUrl;
this.textEl.dom.innerHTML = '<img style="border:0px;" src="' + this.imageUrl + '" />';
},

setUrl : function (url) {
this.url = url;
this.textEl.dom.setAttribute("href", this.url);
},

setTarget : function (target) {
this.target = target;
this.textEl.dom.setAttribute("target", this.target);
}
});

Ext.reg("nethyperlink", Ext.net.HyperLink);

jwf
Aug 22, 2012, 9:11 PM
Thank you Daniil, I'll try to remember to check the source for this kind of thing.