How to make jqgrid treegrid first row text bold

前端 未结 2 1033
情歌与酒
情歌与酒 2021-01-21 10:33

jqgrid treegrid is defined using code below. First level of data contains only single node displayed in first row in jqgrid. How to make this (treegrid first row) text bold ?

相关标签:
2条回答
  • 2021-01-21 10:58

    I think you can solve the problem by usage of rowattr if you want to make the whole row bold (see the answer). You can assign additional class or style attribute on the specified row. Alternatively you can use cellattr to assign class or style only on the cell, for example only on the cell in "menu" column (see the answer). I used standard grids in the referenced answers, but you can use rowattr and cellattr in the same way with TreeGrids. The access to the columns parent, level and isLeaf existing in the TreeGrid can be helpful for you in the implementation.

    UPDATED: Here is the demo which mark bold all items which has no parent:

    enter image description here

    and another demo use more specific rule:

    enter image description here

    In both cases I used CSS rule

    .ui-jqgrid tr.myMarking td { font-weight: bold; }
    

    The implementation of rowattr is very simple and can be for example as below

    rowattr: function (rd) {
        if (rd.parent === "null" && rd.name === "Cash") {
            return {"class": "myMarking"};
        }
    }
    
    0 讨论(0)
  • 2021-01-21 11:10
    #tree-grid .cell-wrapper:first-child
    {
        font-weight: bold;
    }
    

    You just have to skope the 'first-child' of your .css declaration.

    0 讨论(0)
提交回复
热议问题