Hej!
Jag försöker gör min egen webpart funktion, jag använder mig av Atlas.js framework och webpart js.
Nu vill jag anropa ett objekt utan att använda xml-script som MS gör.
Istället för
<webPart id="Block1" titleElement="BlockTitle1" zone="WebPartZone1" zoneIndex="0" allowZoneChange="True" />
vill jag använda javascript, hur gör jag en ny instans av Sys.UI.Controls.WebParts.WebPart?
Hur anropar man den?
Sys.UI.Controls.WebParts.WebPart = function(associatedElement) {
Sys.UI.Controls.WebParts.WebPart.initializeBase(this, [associatedElement]);
var _titleElement;
var _zone;
var _zoneIndex;
var _allowZoneChange = true;
this.get_allowZoneChange = function() {
return _allowZoneChange;
}
this.set_allowZoneChange = function(value) {
_allowZoneChange = value;
}
this.get_titleElement = function() {
return _titleElement;
}
this.set_titleElement = function(value) {
_titleElement = value;
}
this.get_zone = function() {
return _zone;
}
this.set_zone = function(value) {
_zone = value;
}
this.get_zoneIndex = function() {
return _zoneIndex;
}
this.set_zoneIndex = function(value) {
_zoneIndex = value;
}
this.getDescriptor = function() {
var td = Sys.UI.Controls.WebParts.WebPart.callBaseMethod(this, "getDescriptor");
td.addProperty("titleElement", Object, false, Sys.Attributes.Element, true);
td.addProperty("zone", Object);
td.addProperty("zoneIndex", Number);
td.addProperty("allowZoneChange", Boolean);
return td;
}
this.initialize = function() {
Sys.UI.Controls.WebParts.WebPart.callBaseMethod(this, "initialize");
if (_titleElement && _zone.get_webPartManager().get_allowPageDesign() && _zone.get_allowLayoutChange()) {
_titleElement.detachEvent("onmousedown", WebPart_OnMouseDown);
this.element.detachEvent("ondragstart", WebPart_OnDragStart);
this.element.detachEvent("ondrag", WebPart_OnDrag);
this.element.detachEvent("ondragend", WebPart_OnDragEnd);
_titleElement.attachEvent("onmousedown", Function.createDelegate(this, mouseDownHandler));
_titleElement.style.cursor = "move";
}
}