我有一个以这种方式定义的剑道枢轴网格:
<canvas id = "gc" width = "640" height = "480"> </canvas>
<script>
userPlankYPosition =40;
computerPlankYPosition = 40;
plankWidth = 10;
plankHeight =100;
ballPositionX=ballPositionY=50;
ballDimension =6;
XVelocity=YVelocity=4;
playerScore=ComputerScore=0;
computerPlankSpeedinY=4;
var canvas,canvasContext;
window.onload=function() {
canvas=document.getElementById('gc');
canvasContext=canvas.getContext('2d');
setInterval(update, 1000/30);
canvas.addEventListener('mousemove',function(e){
userPlankYPosition = e.clientY-plankHeight/2;
});
};
function reset(){
ballPositionX=canvas.width/2;
ballPositionY=canvas.height/2;
XVelocity-=XVelocity;
YVelocity=3;
};
function update(){
canvasContext.fillstyle='black';
canvasContext.fillRect(0,0,canvas.width,canvas.height);
canvasContext.fillstyle='white';
canvasContext.fillRect(0,userPlankYPosition,plankWidth,plankHeight);
canvasContext.fillRect(canvas.width-plankWidth,computerPlankYPosition,plankWidth,plankHeight);
canvasContext.fillRect(ballPositionX-ballDimension/2,ballPositionY-ballDimension/2,ballDimension,ballDimension);
canvasContext.fillText(playerScore,100,100);
canvasContext.fillText(ComputerScore,canvas.width-100,100);
ballPositionX+=XVelocity;
ballPositionY+=YVelocity;
if(ballPositionY<0 && YVelocity <0){
YVelocity-=YVelocity;
}
if(ballPositionY>canvas.height && YVelocity <0){
YVelocity-=YVelocity;
}
if(ballPositionX<0 )
{
if(ballPositionY>userPlankYPosition && ballPositionY<userPlankYPosition+plankHeight){
XVelocity-=XVelocity;
dy=ballPositionY-(userPlankYPosition+plankHeight/2);
YVelocity = dy*0.3;
}
else{
ComputerScore++;
reset();
}
}
if(ballPositionX>canvas.width )
{
if(ballPositionY>computerPlankYPosition && ballPositionY<computerPlankYPosition+plankHeight){
XVelocity-=XVelocity;
dy=ballPositionY-(computerPlankYPosition+plankHeight/2);
YVelocity = dy*0.3;
}
else{
playerScore++;
reset();
}
};
if(computerPlankYPosition+plankHeight/2<ballPositionY){
computerPlankYPosition+=computerPlankSpeedinY;
}
else{
computerPlankYPosition-=computerPlankSpeedinY;
}
// canvasContext.fillstyle='black';
// canvasContext.fillRect(0,0,canvas.width,canvas.height);
// canvasContext.fillstyle='white';
// canvasContext.fillRect(0,userPlankYPosition,plankWidth,plankHeight);
// canvasContext.fillRect(canvas.width-plankWidth,computerPlankYPosition,plankWidth,plankHeight);
// canvasContext.fillRect(ballPositionX-ballDimension/2,ballPositionY-ballDimension/2,ballDimension,ballDimension);
// canvasContext.fillText(playerScore,100,100);
// canvasContext.fillText(ComputerScore,canvas.width-100,100);
};
这里是脚本<div kendo-pivot-grid
id="pivotGrid"
k-excel="{ fileName: reportCtrl.CurrentReport.DS_REPORT + '.xlsx' }"
k-height="'100%'"
k-sortable="true"
k-filterable="true"
k-row-header-template="'#= rowTemplate #'"
kx-data="resultCtrl.ReportResult"
kx-data-source-options="{
data: resultCtrl.ReportResult,
schema: {
fields: {
DT_MEASURE: { type: 'shortDate' }
},
cube: {
dimensions: {
ID_MEASURE_A: { caption: 'Measure A' },
ID_MEASURE_B: { caption: 'Measure B' },
},
measures: {
'AverageA': { field: 'ID_MEASURE_A', aggregate: 'average' },
'AverageB': { field: 'ID_MEASURE_B', aggregate: 'average' }
}
},
},
columns: [
{ name: 'ID_PRODUCT', expand: true }
],
rows: [
{ name: 'DT_MEASURE', expand: true },
],
measures: ['AverageA', 'AverageB']
}"
kx-vertical-stretch="true">
</div>
:
rowTemplate
我想定义我的rowHeaderTemplate以显示日期的正确格式,但每次尝试都不起作用。
有什么建议吗?