Table with contextmenu don't works if use an external source via sAjaxSource
Table with contextmenu don't works if use an external source via sAjaxSource
FabioDF
Posts: 1Questions: 0Answers: 0
Hello Guys,
I am a new user forum, and i'm not expert of jquery.
I created a table whith a contextmenu for each row and use 'tr' selector to start contextmenu function. Everything works fine if I don't use the'sAjaxSource' parameter. When i replace data in html with an external source via sAjaxSource parameter
it seems that i don't catch 'tr' selector.
Does anyone have any suggestions to solve this problem?.
Thanks in advance.
<!DOCTYPE HTML>
@import "css/contextmenu.css"
$(document).ready(function() {
// Event Table
$('#example').dataTable( {
"bScrollInfinite":true,
"bScrollCollapse":true,
"sScrollY": 200,
"bPaginate": false,
"bSort": false,
//"sAjaxSource": 'array5.txt',
"fnRowCallback": function(nRow,aData,iDisplayIndex) {
$(nRow).addClass(aData[0]);
return nRow;
},
}); // End dataTable
var strWindowFeatures = "width=300,height=300,menubar=no,location=no,resizable=no,scrollbars=yes,status=yes";
var EventCM = [{'Details':{ onclick:function(menuItem,menu)
{window.open('Windows1.html?nome="detail"',strWindowFeatures)},
icon:'images/Details20.png',disabled:false}},
{'Delete':{ onclick:function(menuItem,menu)
{window.open('Windows1.html?nome="delete"',strWindowFeatures)},
icon:'images/Details20.png',disabled:false}}
];
$('tr').contextMenu(EventCM);
} );
SeverityDateCountSource
Normal 24/04/20123MI-PJ67890123456
Critical26/04/20121RM-PJ67890123456
Major 27/04/20122VE-PJ-01
I am a new user forum, and i'm not expert of jquery.
I created a table whith a contextmenu for each row and use 'tr' selector to start contextmenu function. Everything works fine if I don't use the'sAjaxSource' parameter. When i replace data in html with an external source via sAjaxSource parameter
it seems that i don't catch 'tr' selector.
Does anyone have any suggestions to solve this problem?.
Thanks in advance.
<!DOCTYPE HTML>
@import "css/contextmenu.css"
$(document).ready(function() {
// Event Table
$('#example').dataTable( {
"bScrollInfinite":true,
"bScrollCollapse":true,
"sScrollY": 200,
"bPaginate": false,
"bSort": false,
//"sAjaxSource": 'array5.txt',
"fnRowCallback": function(nRow,aData,iDisplayIndex) {
$(nRow).addClass(aData[0]);
return nRow;
},
}); // End dataTable
var strWindowFeatures = "width=300,height=300,menubar=no,location=no,resizable=no,scrollbars=yes,status=yes";
var EventCM = [{'Details':{ onclick:function(menuItem,menu)
{window.open('Windows1.html?nome="detail"',strWindowFeatures)},
icon:'images/Details20.png',disabled:false}},
{'Delete':{ onclick:function(menuItem,menu)
{window.open('Windows1.html?nome="delete"',strWindowFeatures)},
icon:'images/Details20.png',disabled:false}}
];
$('tr').contextMenu(EventCM);
} );
SeverityDateCountSource
Normal 24/04/20123MI-PJ67890123456
Critical26/04/20121RM-PJ67890123456
Major 27/04/20122VE-PJ-01
This discussion has been closed.