Highlight Just Edited Row In Cgridview

Dear All,

I am using the similar approach as in this link, yii playground.

When updating row, we need to select the row in CGridView, then the values of the row will be appear in the form below the CGridView. It works great. However, I want to add a feature to highlight, say using yellow color, or to make it simpler, I want the latest updated row in CgridView is being selected. The idea is to give the operator quicker way to make sure the row is being updated.

Any help on this? Thank you in advance.

Kind regards,


Ya you can do same like this, just need to add few line of jquery code.

eg. -

$('#main_table table tr').live('click',function(){

   $('#main_table table tr').each(function(){




    return false;


this is for you - http://jsfiddle.net/w9brqfmt/

Hi Rohit,

Thank you for the prompt response. However, I am afraid that is not what I need. Probably, my explanation is not clear.

I am actually doing the same thing as in the link. But I want to add one more feature. After save the row, I want to highlight the updated row.

function submitDetail() {


                type: 'POST',

                url: "<?php echo Yii::app()->createUrl('/formHeader/addDetail'); ?>",

                data: $('#form-detail-form').serialize(),

                success: formDetailSaved,

                dataType: 'json'



function updateDetail(url) {

        function formDetailSaved(data) {

        if (data.status == "success") {


//            $('#FormDetail_lotName').val("");

//            $('#FormDetail_lotFk').val("");

//            $('#lot-name-saved').val("");

















            if ($('#FormDetail_id').val() != '') {

                var rowId = "#row-" + $('#FormDetail_id').val();

                $('html,body').animate({scrollTop: ($(rowId).offset().top - 100)}, 500);

                var curRow = $(rowId).get(0);



            // delete id to reset update


            $('#mySubmitButton').html('<i class="icon-plus icon-white"></i>&nbsp');

            toastr.success(data.message, data.title);

        } else {

            toastr.error(data.message, data.title);




Above is my code to save the form and highlight the row. But somehow the trigger click is seemed overwrite by the $fn.yiiGridView.update().

Anyone can help?