PHPRunner/ASPRunnerPro/ASPRunner.NET have a couple of handy events that allow you execute your own code after record was added or edited in inline or in popup mode. For instance, you may want to change some fields appearance based on new data modified or redirect user to view page after record was added in popup mode.
1. Change text color and background color after Inline Add/Edit
To do so add the following code to List page: Javascript OnLoad event.
function funcAfter(fieldsData) {
for (f in fieldsData) {
var field = fieldsData[f];
if (field.name == 'status') {
if (field.value == 'Pending') {
field.container.closest('td').css('background', 'red');
field.container.closest('td').css('color', 'white');
} else if (field.value == 'Active') {
field.container.closest('td').css('background', 'orange');
field.container.closest('td').css('color', 'darkblue');
}
}
}
}
this.on('afterInlineEdit', funcAfter);
this.on('afterInlineAdd', funcAfter);
In this event we evaluate the value of ‘status’ field and then change CSS properties of the cell when this field is located. To save the amount of coding we define the funcAfter function and make it run after both Inline Add and Edit.
This code will work without any changes in PHPRunner, ASPRunnerPro and ASPRunner.NET apps. Here is how it’s going to look.
Continue Reading "Executing your code after Inline Add or Edit" →