更改jqgrid子网格标题栏上的背景颜色,但所有标题栏都在更改颜色

时间:2019-09-03 22:56:23

标签: javascript jqgrid subgrid

我有一个涉及3个子网格的项目,并且我试图至少更改最后一个子网格标题栏的颜色。我尝试了许多不同的代码组合,但尚未获得一个唯一的标题栏来有所不同。我可以更改所有子网格上所有标题栏上的颜色。

我已经上网了一段时间,但没有找到做简单事情的好方法。

这是我尝试过的最后3次尝试:

afterInsertRow: function (id, currentData, jsondata) {                            
        if ($("#" + "PT").getGridParam('lastpage') === 0) {
          CMN.OkDialog("No Data To Display");
          }
          else {
            var HeaderFontColor = "black";
            var HeaderBackgroundColor = "brown";      
            //Ths does not produce the results I am looking
            //for this is all the title bars
            $('.ui-jqgrid-titlebar').each(function () {                                    
               this.style.color = HeaderFontColor;
               this.style.background = HeaderBackgroundColor;
             });
           }
         },



    afterInsertRow: function (id, currentData, jsondata) {                            
       if ($("#" + "PT").getGridParam('lastpage') === 0) {
        CMN.OkDialog("No Data To Display");
      }
      else {
        var HeaderFontColor = "black";
        var HeaderBackgroundColor = "brown";      
        //Ths does not produce the results I am looking 
        //for this is also does all the title bars
        $("#" + "PT").jqgrid(
             $('.ui-jqgrid-titlebar').each(function () {                                    
             this.style.color = HeaderFontColor;
             this.style.background = HeaderBackgroundColor;
             }));
        }
    },




    afterInsertRow: function (id, currentData, jsondata) {                            
       if ($("#" + "PT").getGridParam('lastpage') === 0) {
         CMN.OkDialog("No Data To Display");
       }
       else {
         var HeaderFontColor = "black";
         var HeaderBackgroundColor = "brown";      
        //This does not produce the results I am looking for 
        //this does not change any title bars. 
         $("#" + "PT").jqgrid(
         $('.ui-jqgrid-titlebar').last(function () {                                    
           this.style.color = HeaderFontColor;
           this.style.background = HeaderBackgroundColor;
         }));
       }
     },

希望有人可以帮助我至少使子网格的标题栏之一有所不同。

0 个答案:

没有答案