两个Spread要实现行选择的时候行索引同步,使用了ActiveCellChanged事件。但是画面加载完成后,第一次点击Spread内的行不会触发该事件。
第二次以后可以。前台控制js代码如下,希望能帮助解决一下,万分感谢
<script type="text/javascript">
window.onload = function () {
var gvDesignList = document.getElementById('<%=fp1.ClientID%>');
if (gvDesignList.addEventListener) {
gvDesignList.addEventListener("ActiveCellChanged", acfp2, false);
} else {
gvDesignList.onActiveCellChanged = ac;
}
var gvProcDesignList = document.getElementById('<%=fp2.ClientID%>');
if (gvProcDesignList.addEventListener) {
gvProcDesignList.addEventListener("ActiveCellChanged", acfp1, false);
} else {
gvProcDesignList.onActiveCellChanged = acfp2;
}
function acfp1(event) {
var row = event.spread.GetActiveRow();
var gvProcDesignList = document.getElementById('<%=fp1.ClientID%>');
if (gvProcDesignList == document.activeElement) { }
else {
var activecol = gvProcDesignList.GetActiveCol();
gvProcDesignList.SetActiveCell(row, activecol);
}
}
function acfp2(event) {
var row = event.spread.GetActiveRow();
var gvDesignList = document.getElementById('<%=fp2.ClientID%>');
var activecol = gvProcDesignList.GetActiveCol();
if (gvDesignList == document.activeElement) { }
else {
var activecol = gvDesignList.GetActiveCol();
gvDesignList.SetActiveCell(row, activecol);
}
}
}
</script>
|
|