![]() | Steema Issues DatabaseNote: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;otherwise you can use StackOverflow. Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy. |
| Summary: | [TW77012763] Using attached example, ClickLegend event needs to have AutoPostBack ... | ||
|---|---|---|---|
| Product: | .NET TeeChart | Reporter: | narcís calvet <narcis> |
| Component: | WebChart | Assignee: | Steema Issue Manager <issuemanager> |
| Status: | IN_PROGRESS --- | ||
| Severity: | enhancement | CC: | marc |
| Priority: | High | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Chart Series: | --- | Delphi / C++ Builder RAD IDE Version: | |
| Attachments: | Clientside Javascript code to actuate postback without AutoPostback active. | ||
|
Description
narcís calvet
2013-11-20 11:26:58 EST
Created attachment 229 [details]
Clientside Javascript code to actuate postback without AutoPostback active.
Zip includes a webform page with TeeChart on it and code behind to respond to Legend checkbox clicks.
Postback can be controlled by clientside Javascript. See the attached zipfile example ExampleCustomPostback.zip.
We'll look to incorporating this into the product to that it won't be necessary to add/write this code in the future. Changed to feature request
webform code (add this into the page header area):
=============
<script type="text/javascript">
var is_ie = navigator.appName == 'Microsoft Internet Explorer';
this.getLocation = function (chObj) {
var dynaObj = chObj;
var overallTop = 0;
var overallLeft = 0;
if (is_ie) {
var objb = dynaObj.getBoundingClientRect();
overallLeft += objb.left;
overallTop += objb.top;
}
else
while (dynaObj.offsetParent) {
overallTop = overallTop + dynaObj.offsetTop;
overallLeft = overallLeft + dynaObj.offsetLeft;
dynaObj = dynaObj.offsetParent;
}
if ((chObj.style.position != "absolute") || (chObj.style.posTop == null)
|| (chObj.style.top == "")) {
chObj.style.posTop = overallTop;
}
if ((chObj.style.position != "absolute") || (chObj.style.posLeft == null)
|| (chObj.style.left == "")) {
chObj.style.posLeft = overallLeft;
}
}
this.activatePostback = function (chart, evt) {
evt = (evt) ? evt : event;
var oVDiv = document.getElementById(chart);
if ((oVDiv.style.position != "absolute") || (oVDiv.style.posTop == null)
|| (oVDiv.style.top == "")
|| (oVDiv.style.posLeft == null)
|| (oVDiv.style.left == "")) {
getLocation(oVDiv);
}
var eClientX;
var eClientY;
var xPos;
var yPos;
var scrollOffsetX;
var scrollOffsetY;
eClientX = evt.clientX;
eClientY = evt.clientY;
if (is_ie) {
event.cancelBubble = true;
scrollOffsetX = iebody.scrollLeft;
scrollOffsetY = iebody.scrollTop;
}
else {
evt.cancelBubble = true;
scrollOffsetX = window.pageXOffset;
scrollOffsetY = window.pageYOffset;
}
xPos = eClientX + scrollOffsetX;
yPos = eClientY + scrollOffsetY;
if (is_ie) {
__doPostBack(chart, 'chart$' + chart + ';xPos$'
+ (eClientX - oVDiv.style.posLeft) + ';yPos$'
+ (eClientY - oVDiv.style.posTop));
}
else {
__doPostBack(chart, 'chart$' + chart + ';xPos$'
+ (xPos - oVDiv.style.posLeft) + ';yPos$'
+ (yPos - oVDiv.style.posTop));
}
}
</script>
=============
Retouch the TeeChart declaration on the page, add onclick="activatePostback('WebChartName',event)"
=============
<tchart:WebChart ID="WebChart2" onclick="activatePostback('WebChart2',event)" runat="server" TempChart="Session" AutoPostback="False" OnClickLegend="WebChart2_ClickLegend" Height="300px" Width="400px" />
=============
|