How to add button in HeaderSpan of SmartGWT

前端 未结 5 1321
轮回少年
轮回少年 2021-01-28 13:39

I want to add a button to the HeaderSpan of ListGrid in SmartGWT. I tried using the \'HeaderSpan.setAttribute((String property, Object value)) method but it did not work. Below

5条回答
  •  悲&欢浪女
    2021-01-28 14:14

    I'm testing it, as I need to put a Calendar in a HeaderSpan. Thanks for sharing your idea, it's of great help, although it took a while to set the correct imports.

    A note : the setHeaderSpanButtons() method will only work if the datasource of the ListGrid is set. If it's not, no header at all is shown.

    An improvement : you can add a break in the loop, no need to loop the whole NodeList:

    if(element.getInnerHTML().toString().equals("Identification")) {
                element.setInnerHTML(null);
                element.insertFirst(createHeaderSpanContents());
                break;
            }
    

    A question : what is the purpose of this line:

    this.getAttribute("headerSpans");
    

    And finally, it doesn't work for me - the span stays always as text "Identification". Any suggestions?

    Thanks.

提交回复
热议问题