我有一个简单的页面,它使用数据表显示呼叫中心队列,并使用上下文菜单(委托给此数据表)我想指定呼叫中心代理来呼叫队列中的呼叫。然而,问题是当右键单击控制台日志时显示“未指定项目”。是的,他们是......有人可以帮我看看我在哪里犯了致命错误......?
来自 ActiveList 的数据是一个 JSON 结果(数组),仅包含 { "Agent": "Mario" } 等。我已经尝试将 ri.agent 分配给结果,但这不起作用。
// Call the dataTables jQuery plugin - SQL Server Wachtrij view.
$(document).ready(function() {
var table = $('#dataTable').dataTable(
{
"bPaginate": false,
"bFilter": false,
"bInfo": false,
"bProcessing": false,
"sAjaxSource": "wachtrij.php",
"aoColumns": [
{ mData: 'callcenter' } ,
{ mData: 'Tijdstip_binnengekomen' },
{ mData: 'Wachttijd'},
{ mData: 'telefoonnummer'},
{ mData: 'Wachtrij_Positie'},
{ mData: 'callid'},
{"defaultContent":'<button
class="btn">Toewijzen aan Agent</button>'}
],
})
// Make sure dataTable refreshes every 5 seconds
setInterval( function () {
table.api().ajax.reload();
}, 5000 );
$.contextMenu({
selector: '#dataTable td',
trigger: 'right',
build: function ($trigger, e)
{
// check if the menu-items have been saved in the previous call
if ($trigger.data("contextMenuItems") != null)
{
// get options from $trigger
var options = $trigger.data("contextMenuItems");
// clear $trigger.data("contextMenuItems"),
// so that menuitems are gotten next time user does a rightclick
// from the server again.
$trigger.data("contextMenuItems", null);
return options;
}
else
{
var options = {
callback: function (key)
{
alert(key);
},
items: {}
};
$.ajax({
method: "GET",
url: "ActiveList.php",
"aoColumns": [
{ aData: 'agent' }
],
胡子哥哥