0

I have a table that is JQuery .editable, however I have it set that when you make a successful edit, the field flashes green or red for unsuccessful edit and then return to the original field colour.

The code is as follows:

$('.editablePM').editable('<?php echo base_url();?>ratesheet/editrowpeakMin/<?=$editable['url'];?>/', 
        {
        callback: function(value){
            $(this).data('bgcolor', $(this).css('background-color'));
            if(value == this.revert)
                {                                                                            
                $(this).animate({ backgroundColor: "red", color: "white" }, 400);
                $(this).animate({ backgroundColor: $(this).data('bgcolor'), color: "black" }, 400);
                }
            else
                {                                                                               
                $(this).animate({ backgroundColor: "green", color: "white" }, 400);
                $(this).animate({ backgroundColor: $(this).data('bgcolor'), color: "black" }, 400);
                }
             }, 
         name : 'value',
         style : 'display:inline; position:relative; right:120px;',
         width : '100px',
         height: '16px',
         onblur : 'submit', 
     });

Everything works fine, however when the field changes to the appropriate colour on the edit, on its return, it no longer has the parent css, and rather an adopted js css.

E.G

I have a hover function on the rows thats highlights the selected row in yellow. now if you deselect the row (thus posting the change) and leave the icon on the row, the background for the initial cell remains yellow.

Equally if you "submit" the change of the cell while off the hover (so is not yellow) the background of the cell returns to the correct colour however no longer responds to the row highlight.

Any help would be appreciated, I have tried a massive amount of variations in the code so I figure its something I am missing.

http://jsfiddle.net/qrA6y/ = attempt to show it happening.

Ignore the information. if you edit a field and unselect while still hovering on that row, it remains yellow, and similarly if you unselect while it isn't yellow, it no longer hovers yellow.

4

0 回答 0