Description:
In this
example we explain that how to adding row colors to Dynamic CRM subgrid based
on value in cells. Or how to change the color of the rows in subgrid based on
cell values in Dynamic CRM using JavaScript. Or how to highlight the rows of
the subgrid control in Dynamic CRM using JavaScript. Or how to change the
background color of the subgrid rows based on condition in dynamic CRM using JavaScript.
Here
below is the code that demonstrate that how to change the background color of
the cells in subgrid of the Dynamic CRM using JavaScript.
function subGridOnload()
{
var grid = $(‘#accountcasessgrid’); //Replace Grid name here
if (grid == null)
{
// delay one second and try again.
setTimeout(subGridOnload, 1000);
return;
}
{
var grid = $(‘#accountcasessgrid’); //Replace Grid name here
if (grid == null)
{
// delay one second and try again.
setTimeout(subGridOnload, 1000);
return;
}
if(grid[0] == undefined)
{
// delay one second and try again.
setTimeout(subGridOnload, 1000);
return;
}
{
// delay one second and try again.
setTimeout(subGridOnload, 1000);
return;
}
if(grid[0].control == undefined)
{
// delay one second and try again.
setTimeout(subGridOnload, 1000);
return;
}
{
// delay one second and try again.
setTimeout(subGridOnload, 1000);
return;
}
if(grid[0].control == null)
{
// delay one second and try again.
setTimeout(subGridOnload, 1000);
return;
}
{
// delay one second and try again.
setTimeout(subGridOnload, 1000);
return;
}
if
(grid[0].control.get_totalRecordCount() == -1)
{
// delay one second and try again.
setTimeout(subGridOnload, 1000);
return;
}
{
// delay one second and try again.
setTimeout(subGridOnload, 1000);
return;
}
// logic Replace status names and
colours as required
$(‘#accountcasessgrid td’).filter(function()
{
return $(this).text() == ‘Resolved’;
}).closest(‘tr’).css(‘background-color’, ‘green’);
$(‘#accountcasessgrid td’).filter(function() {
return $(this).text() == ‘Active’;
}).closest(‘tr’).css(‘background-color’, ‘yellow’);
return $(this).text() == ‘Resolved’;
}).closest(‘tr’).css(‘background-color’, ‘green’);
$(‘#accountcasessgrid td’).filter(function() {
return $(this).text() == ‘Active’;
}).closest(‘tr’).css(‘background-color’, ‘yellow’);
}
0 comments:
Post a Comment