我正在尝试在Rally中使用自定义页面,该页面使用iframe链接到我的外部应用程序。在运行时,我从Rally收到一个与sdk.js文件相关的javascript错误。
我做错了什么?
Javascript错误:
用于我的自定义页面的代码:
<script type="text/javascript" src="/apps/2.0p4/sdk.js"></script>
<script type="text/javascript">
Rally.onReady(function() {
Ext.define('CustomApp', {
extend: 'Rally.app.App',
componentCls: 'app',
launch: function() {
var user = this.getContext().getUser();
var projectId = Rally.environment.getContext().getProject().ObjectID;
document.write('<div id="Timesheet"><iframe src="https://myserver/Entry.aspx?RallyUserName=' + user.UserName + '&RallyProject='+ projectId +'" height=90% width=100% style="border-top-width: 0px;border-right-width: 0px;border-bottom-width: 0px;border-left-width: 0px;"></iframe></div>');
},
});
Rally.launchApp('CustomApp', {
name: 'Timesheets'
});
});
</script>
此致 圣保罗
答案 0 :(得分:0)
我建议您根据需要使用自定义网址应用:
答案 1 :(得分:0)
当你在sdk深处发现奇怪的错误时,包含sdk-debug.js而不是sdk.js通常会有所帮助。您将获得更好的堆栈跟踪,可以帮助您追踪正在发生的事情。
在这种情况下,你的document.write代码正在吹掉应用程序期望存在的dom元素。使用Ext创建你的dom元素,你应该全部设置:
Ext.define('CustomApp', {
extend: 'Rally.app.App',
componentCls: 'app',
items: [
{ xtype: 'container', itemId: 'Timesheet' }
],
launch: function() {
this.down('#Timesheet').add({
xtype: 'component',
autoEl: {
tag: 'iframe',
src: '',
//...
}
});
}
或者从应用程序中的任何容器或组件,您始终可以调用getEl()并直接使用dom元素。