fnRowCallback issue
fnRowCallback issue
Hi!
I'm trying to render my cells with fnRowCallback and I'm doing it as it follows
[code]
"fnRowCallback" : function(nRow, aData, iDisplayIndex) {
if (aData[3] == "2") {
$('td:eq(2)', nRow)
.html(''+aData[3]+'').attr("class","kritikal")
.children('a.critical')
.click(function(){
toAjax(aData[1],aData[2], "AgentCrashes");
});
}
else if
(aData[4] == 123) {
{
$('td:eq(3)', nRow)
.html(''+aData[4]+'').attr("class","kritikal")
.children('a.critical')
.click(function(){
toAjax(aData[1],aData[2], "Workload");
});
}
}
return nRow;
},
[/code]
My problem is when if in the same row but in different columns the condition is true , just the first hyper link in the first column is firing up.
thanks for every suggestion
I'm trying to render my cells with fnRowCallback and I'm doing it as it follows
[code]
"fnRowCallback" : function(nRow, aData, iDisplayIndex) {
if (aData[3] == "2") {
$('td:eq(2)', nRow)
.html(''+aData[3]+'').attr("class","kritikal")
.children('a.critical')
.click(function(){
toAjax(aData[1],aData[2], "AgentCrashes");
});
}
else if
(aData[4] == 123) {
{
$('td:eq(3)', nRow)
.html(''+aData[4]+'').attr("class","kritikal")
.children('a.critical')
.click(function(){
toAjax(aData[1],aData[2], "Workload");
});
}
}
return nRow;
},
[/code]
My problem is when if in the same row but in different columns the condition is true , just the first hyper link in the first column is firing up.
thanks for every suggestion
This discussion has been closed.
Replies
Allan
Unfortunately my problem still persist when I have some values what are in the same row but in different columns they don't pick up the hyper link.
[code]
"fnRowCallback" : function(nRow, aData, iDisplayIndex) {
var this_class = "gradeX";
var i=2;
for (i=2;i<=9;i++)
{
switch(aData[i]){
case(aData[2] ):
if(aData[2]){
$('td:eq(2)', nRow)
.html(''+aData[2]+'')
.children('a.link');
break;
}
else{
$('td:eq(2)', nRow)
.html(''+aData[2]+'')
.children('a.link');
break;
}
break;
case(aData[3] ):
if(aData[3]!="--"){
if(aData[3]>'500'){
$('td:eq(3)', nRow)
.html(''+aData[3]+'').attr("class","kritikal")
.children('a.critical');
break;
}
else{
$('td:eq(3)', nRow)
.html(''+aData[3]+'')
.children('a.link');
break;
}
}
case (aData[4]):
if(aData[4]!="--"){
if(aData[4]>'40'){
$('td:eq(4)', nRow)
.html(''+aData[4]+'').attr("class","kritikal")
.children('a.critical');
break;
}
else {
$('td:eq(4)', nRow)
.html(''+aData[4]+'')
.children('a.link');
break;
}
}
case (aData[5]):
if(aData[5]!="--"){
if(aData[5]> '150'){
$('td:eq(5)', nRow)
.html(''+aData[5]+'').attr("class","kritikal")
.children('a.critical');
break;
}
else {
$('td:eq(5)', nRow)
.html(''+aData[5]+'')
.children('a.link');
break;
}
}
case (aData[6]):
if(aData[6]!="--"){
if(aData[6]>'600'){
$('td:eq(6)', nRow)
.html(''+aData[6]+'')
.children('a .critical');
break;
}
else {
$('td:eq(6)', nRow)
.html(''+aData[6]+'')
.children('a.link');
break;
}
}
case (aData[7]):
if(aData[7]!="--"){
if(aData[7]>100){
$('td:eq(7)', nRow)
.html(''+aData[7]+'').attr("class","kritikal")
.children('a.critical');
break;
}
else
{
$('td:eq(7)', nRow)
.html(''+aData[7]+'')
.children('a.link');
break;
}
}
case (aData[8]):
if(aData[8]!="--"){
if(aData[8]>100){
$('td:eq(8)', nRow)
.html(''+aData[8]+'').attr("class","kritikal")
.children('a.critical');
break;
}
else
{
$('td:eq(8)', nRow)
.html(''+aData[8]+'')
.children('a.link');
break;
}
}
case (aData[9]):
if(aData[9]!="--"){
if(aData[9]>600){
$('td:eq(9)', nRow)
.html(''+aData[9]+'').attr("class","kritikal")
.children('a.critical');
break;
}
else {
$('td:eq(9)', nRow)
.html(''+aData[9]+'')
.children('a.link');
[/code]
break;
}
}
}
}
return nRow;
},