如何让 jQuery colorbox 模块在 Flexigrid 中工作?
我正在使用 Flexigrid 在 CRM 中显示传入的潜在客户。在传入线索的行中,我添加了“查看联系人”和“查看注释”的链接。我试图让这些链接在单击时在彩盒模块中打开。当前单击时它们会在新窗口中打开。
HTML/Flexigrid 代码:
<div id="flex"></div>
<script type="text/javascript">
$(document).ready(function(e){
$(".merchant_add_note").colorbox({width:"750px", overlayClose:false, height:"400px", transition:"none"});
$(".merchant_add_contact").colorbox({width:"750px", overlayClose:false, height:"400px", transition:"none"});
$(".merchant_view_notes").colorbox({width:"750px", overlayClose:false, height:"400px", transition:"none"});
$(".merchant_view_contacts").colorbox({width:"750px", overlayClose:false, height:"400px", transition:"none"});
$("#flex").flexigrid({
url: '/rep/get_leads',
dataType: 'json',
method: 'GET',
colModel : [
{display: 'Merchant', name : 'merchant_name', width : 220, sortable : true, align: 'left'},
{display: 'Date Added', name : 'merchant_created', width : 150, sortable : true, align: 'left'},
{display: 'Last Contacted', name : 'merchant_last_contacted', width : 150, sortable : false, align: 'left'},
{display: 'Contact', name : 'merchant_contacts', width : 180, sortable : false, align: 'left'},
{display: 'Notes', name : 'merchant_notes', width : 160, sortable : false, align: 'left'}
],
sortname: "merchant_name",
sortorder: "asc",
usepager: false,
useRp: false,
rp: 50,
width: 950,
height: 500
});
});
</script>
/rep/get_leads json 数组:
function get_leads(){
$args = array(
'id' => $this->session->userdata('rep_id'),
'sort' => $_REQUEST['sortname'],
'sortorder' => $_REQUEST['sortorder']
);
$leads = $this->reps->leads($args);
foreach($leads as $lead){
$row['id'] = $lead['merchant_id'];
$row['cell'] = array(
'merchant_name' => '<a href="/rep/merchant/'.$lead['merchant_id'].'">'.$lead['merchant_name'].'</a>',
'merchant_created' => $lead['merchant_created'],
'merchant_last_contacted' => $lead['merchant_last_contacted'],
'merchant_contacts' => '<a href="/rep/merchant_contacts/'.$lead['merchant_id'].'" class="small_blue merchant_view_contacts">View</a> - <a href="/rep/merchant_add_contact/'.$lead['merchant_id'].'" class="small_blue merchant_add_contact">Add</a>',
'merchant_notes' => '<a href="/rep/merchant_notes/'.$lead['merchant_id'].'" class="small_blue merchant_view_notes">View</a> - <a href="/rep/merchant_add_note/'.$lead['merchant_id'].'" class="small_blue merchant_add_note">Add</a>'
);
$array[] = $row;
}
$data['rows'] = $array;
print json_encode($data);
}
I'm using flexigrid to display incoming leads in our CRM. Within the rows of incoming leads, I've added links for "View Contacts" and "View Notes". I'm trying to get these links to open in a colorbox module when clicked. They currently opening in a new window when clicked.
HTML/Flexigrid Code:
<div id="flex"></div>
<script type="text/javascript">
$(document).ready(function(e){
$(".merchant_add_note").colorbox({width:"750px", overlayClose:false, height:"400px", transition:"none"});
$(".merchant_add_contact").colorbox({width:"750px", overlayClose:false, height:"400px", transition:"none"});
$(".merchant_view_notes").colorbox({width:"750px", overlayClose:false, height:"400px", transition:"none"});
$(".merchant_view_contacts").colorbox({width:"750px", overlayClose:false, height:"400px", transition:"none"});
$("#flex").flexigrid({
url: '/rep/get_leads',
dataType: 'json',
method: 'GET',
colModel : [
{display: 'Merchant', name : 'merchant_name', width : 220, sortable : true, align: 'left'},
{display: 'Date Added', name : 'merchant_created', width : 150, sortable : true, align: 'left'},
{display: 'Last Contacted', name : 'merchant_last_contacted', width : 150, sortable : false, align: 'left'},
{display: 'Contact', name : 'merchant_contacts', width : 180, sortable : false, align: 'left'},
{display: 'Notes', name : 'merchant_notes', width : 160, sortable : false, align: 'left'}
],
sortname: "merchant_name",
sortorder: "asc",
usepager: false,
useRp: false,
rp: 50,
width: 950,
height: 500
});
});
</script>
/rep/get_leads json array:
function get_leads(){
$args = array(
'id' => $this->session->userdata('rep_id'),
'sort' => $_REQUEST['sortname'],
'sortorder' => $_REQUEST['sortorder']
);
$leads = $this->reps->leads($args);
foreach($leads as $lead){
$row['id'] = $lead['merchant_id'];
$row['cell'] = array(
'merchant_name' => '<a href="/rep/merchant/'.$lead['merchant_id'].'">'.$lead['merchant_name'].'</a>',
'merchant_created' => $lead['merchant_created'],
'merchant_last_contacted' => $lead['merchant_last_contacted'],
'merchant_contacts' => '<a href="/rep/merchant_contacts/'.$lead['merchant_id'].'" class="small_blue merchant_view_contacts">View</a> - <a href="/rep/merchant_add_contact/'.$lead['merchant_id'].'" class="small_blue merchant_add_contact">Add</a>',
'merchant_notes' => '<a href="/rep/merchant_notes/'.$lead['merchant_id'].'" class="small_blue merchant_view_notes">View</a> - <a href="/rep/merchant_add_note/'.$lead['merchant_id'].'" class="small_blue merchant_add_note">Add</a>'
);
$array[] = $row;
}
$data['rows'] = $array;
print json_encode($data);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想通了。我需要使用 onSuccess:
I figured it out. I needed to use onSuccess: