jqGrid Coloring an entire line in Grid based upon a cells value

前端 未结 7 1849
难免孤独
难免孤独 2020-12-03 04:05

I know it\'s been asked before, but I cant get it to run and I\'m out of things to try.

I want to colorize a row in a Grid if its value is not 1 - I use a custom for

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-03 04:56

    It seems to me that your main problem is you're not setting a 'background-color' style. You should remove 'ui-widget-content' class from the row (from element)

    jQuery("#"+ options.rowId,jQuery('#list2')).removeClass('ui-widget-content');
    

    before adding the class state_activ or state_inactive, because jQuery UI class 'ui-widget-content' is define .ui-widget-content like

    {
    border: 1px solid #fad42e;
    background: #fbec88 url(images/ui-bg_flat_55_fbec88_40x100.png) 50% 50% repeat-x;
    color: #363636;
    }
    

    and only with setting of CSS 'background-color' your not really change the background color. So try to use something like

    var trElement = jQuery("#"+ options.rowId,jQuery('#list2'));
    trElement.removeClass('ui-widget-content');
    trElement.addClass('state_active');
    

提交回复
热议问题