Fancybox 似乎不适用于 Coldfusion CFGRID 标签
我是第一次尝试 CFGRID。虽然网格本身工作得很好,但我无法获得在列内工作的 Fancybox 链接。我在下面添加了相关代码。基本上,我执行一个查询,添加一个包含链接的查询列,然后在 cfgrid 中输出结果:
<cfquery name="qSessions" datasource="">
SELECT id, title
FROM EVENTS
WHERE c_fkid = 1
</cfquery>
<cfset QueryAddColumn(qSessions,"edit_link","varchar",ArrayNew(1))>
<cfset i = 0>
<cfloop query="qSessions">
<cfset i = i + 1>
<cfset thisText = "<a href='./datagridFB.cfm?no_app=1' class='edit-session' id=" & i & ">Edit this session</a>">
<cfset QuerySetCell(qSessions,"edit_link",thisText, currentRow)>
</cfloop>
<head>
<!--- Javascript library/CSS links would go here --->
<script type="text/javascript">
$j = jQuery.noConflict();
/* Reload the page */
function refreshParent(){
window.location.reload(true);
}
/* Initialization actions on doc ready */
$j(document).ready(function() {
$j(".edit-session").fancybox({
'width' : 600,
'height' : 350,
'hideOnContentClick': false,
'transitionIn' : 'elastic',
'transitionOut' : 'fade',
'type' : 'iframe',
'href' : $j(this).href,
'overlayOpacity' : 0.6,
'onCleanup' : function(){refreshParent()}
});
});
</script>
</head>
<body>
<!---Test Fancybox links outside the CFGRID--->
<a href="./datagridFB.cfm?no_app=1" id="test-link" class="edit-session">Test FB</a>
<!--- Output the results of the query --->
<h2 class="header">Sessions in the Database</h2>
<cfform id="testForm" name="testForm" method="post">
<cfgrid name="testGrid" format="html" query="qSessions" width="500">
<cfgridcolumn name="id" header="ID">
<cfgridcolumn name="title" header="Session Title" width="300">
<cfgridcolumn name="edit_link" header="Edit">
</cfgrid>
</cfform>
</body>
问题是测试链接(在 CFGRID 之外)工作得很好。单击它,Fancybox iFrame 将打开。但 CFGRID 内的链接不会产生弹出窗口 - 它们会直接将您带到该页面。谁能对此提供一些指导?这是否与 CFGRID 是基于 Ext.js 构建的这一事实有关?谢谢!
I am trying out CFGRID for the first time. While the grid itself works just fine, I can not get a Fancybox link to work inside the columns. I've added relevant code below. Basically, I do a query, add a query column that contains a link, then output the results in a cfgrid:
<cfquery name="qSessions" datasource="">
SELECT id, title
FROM EVENTS
WHERE c_fkid = 1
</cfquery>
<cfset QueryAddColumn(qSessions,"edit_link","varchar",ArrayNew(1))>
<cfset i = 0>
<cfloop query="qSessions">
<cfset i = i + 1>
<cfset thisText = "<a href='./datagridFB.cfm?no_app=1' class='edit-session' id=" & i & ">Edit this session</a>">
<cfset QuerySetCell(qSessions,"edit_link",thisText, currentRow)>
</cfloop>
<head>
<!--- Javascript library/CSS links would go here --->
<script type="text/javascript">
$j = jQuery.noConflict();
/* Reload the page */
function refreshParent(){
window.location.reload(true);
}
/* Initialization actions on doc ready */
$j(document).ready(function() {
$j(".edit-session").fancybox({
'width' : 600,
'height' : 350,
'hideOnContentClick': false,
'transitionIn' : 'elastic',
'transitionOut' : 'fade',
'type' : 'iframe',
'href' : $j(this).href,
'overlayOpacity' : 0.6,
'onCleanup' : function(){refreshParent()}
});
});
</script>
</head>
<body>
<!---Test Fancybox links outside the CFGRID--->
<a href="./datagridFB.cfm?no_app=1" id="test-link" class="edit-session">Test FB</a>
<!--- Output the results of the query --->
<h2 class="header">Sessions in the Database</h2>
<cfform id="testForm" name="testForm" method="post">
<cfgrid name="testGrid" format="html" query="qSessions" width="500">
<cfgridcolumn name="id" header="ID">
<cfgridcolumn name="title" header="Session Title" width="300">
<cfgridcolumn name="edit_link" header="Edit">
</cfgrid>
</cfform>
</body>
The thing is that the test link (outside the CFGRID) works just fine. Click it and the Fancybox iFrame opens up. But the links inside the CFGRID don't produce a pup-up - they take you to the page directly. can anyone provide some guidance on this? Is it related to the fact that CFGRID is built on Ext.js or something? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是,混合 jQuery 和 cfform 的 ajax 从来都不是一个好主意。也许考虑将 cfgrid 的使用移植到 jQuery 网格插件之一?
或者使用
而不是 Fancybox?Unfortunately, mixing jQuery and cfform's ajax is never a good idea. Maybe consider porting the use of cfgrid to one of the jQuery grid plugin?
Or use
<cfwindow>
instead of Fancybox?