본문 바로가기
개발/Javascript

[jqGrid] 특정 셀에 css 적용하기

by 그저그런보통사람 2017. 3. 8.

1) afterInsertRow 함수 이용 (이 경우 성능이 저하된다. gridview: false)

gridview:false,
afterInsertRow: function (rowid, rowdata, rowelem) {                         
    var self =$(this); 
    $.each(rowdata, function(k, v){                                
        if (parseInt(v) > 0){
            self.setCell(rowid, k, "", { 
                "color": "red", 
                "background-color": "goldenrod" 
            });
        }
    });
},



2) loadComplete 함수 이용

  loadComplete: function(){         var self =$(this);          var ids = self.jqGrid("getDataIDs"), l = ids.length, i, rowid, status;         for (= 0; i < l; i++) {             rowid = ids[i];             // get data from some column "readStatus"             //status = $(this).jqGrid("getCell", rowid, "readStatus");             // or get data from some              var rowData = self.jqGrid("getRowData", rowid);             $.each(rowData, function(k,v){                 if (parseInt(v) > 0) {                     self.jqGrid('setCell', rowid, k, "", 'ndf-highight');                     //$('#' + $.jgrid.jqID(rowid)).addClass('ndf-highight');                 }             });         }     }


'개발 > Javascript' 카테고리의 다른 글

doctype 사용시 scrolltop 값 가져오기.  (0) 2010.04.30