ben*_*pps 7 javascript coldfusion
我有一个使用CFlayout生成动态标签的应用程序.每个选项卡都由变量组合组成,但就本文而言,没有必要进入该选项.
这是有趣的.过去,如果CFlayout找不到标签,我总是会收到错误.如果我更改选项卡名称是什么(知道它将是不正确的)Coldfusion会抛出错误,所以我知道选项卡正常存在,但无论出于何种原因,它都没有切换.
以下是我的代码:
JavaScript的
var uniqueTopTabID = someVar,
uniqueLowerTabID = uniqueTopTabID + someVar,
$topLayoutID = $('#cf_layoutarea' + uniqueTopTabID), //jquery objects to find if the tabs exist
$lowerTabID = $('#cf_layoutarea' + uniqueLowerTabID); //same as above
Run Code Online (Sandbox Code Playgroud)
以下是创建新选项卡或选择以前创建的选项卡的逻辑:
if ( $topLayoutID.length < 1 ) {
ColdFusion.Layout.createTab('innerTabLayout', uniqueTopTabID, 'tabName' , cfLayoutLocation, {inithide: false, selected: true, closable: true});
}
//if the subsystem and WBS have already been selected, focus on that tab
else if ( $lowerTabID.length !== 0 ) {
ColdFusion.Layout.selectTab( uniqueTopTabID, uniqueLowerTabID );
//i have also tried to select the top tab, and then select the bottom tab but that doesn't work either
}
Run Code Online (Sandbox Code Playgroud)
就像我说的那样,没有抛出任何错误 - 我可以看到焦点来自当前的父选项卡,但无论出于何种原因,它都没有选择其他顶级选项卡.但是,如果尝试创建的选项卡位于当前父选项卡下,则它将选择较低级别选项卡.
以下是我在ColdFusion方面生成选项卡的方法:
<cfif structKeyExists(URL,"bp")> <!--- make sure some var is available --->
<cfset actualsScenarioView = "actualsScenarioView"&URL.ss>
<cflayout name="#actualsScenarioView#" type="tab">
<cfset scenarioName = URL.tabId>
<cfset tabTitle = URL.subSystemName & ': ' & URL.wbsName>
<cfset sourceFile = 'the URL passed in' >
<cflayoutarea name="#scenarioName#" title="#tabTitle#" source="#sourceFile#" refreshOnActivate="false" closable="true">
</cflayoutarea>
</cflayout>
<cfelse>
<!--- if vars not avail, the page was request prior to submission, and will show noting--->
</cfif>
Run Code Online (Sandbox Code Playgroud)
标签创建得很好,除了选择不同的父标签外,一切都有效.
任何帮助是极大的赞赏.
ColdFusion 的几乎所有显示方面都很糟糕。ColdFusion是一个很棒的中间件,但是它不擅长编写JavaScript,无论是表单验证还是div。
您应该认真考虑在没有 cflayout 的情况下重写,看看http://static.raymondcamden.com/cfuitherightway/cflayout-tabs/index.html这是 Raymond Camden 和 Adam Cameron 的博客,概述了如何更好地处理ColdFusion 不擅长的事情。这是一个很好的资源。