javasmartgwtlistgrid

SmartGWT - how to check if ListGridRecord is expanded or collapsed?


I have customized ListGrid, in which records can be expanded and expansion component is displayed. I know there exists little arrow to expand/collapse record in upper left corner of the record, but I wonder if it is possible to manually check if the selected record is expanded or collapsed. I want the record to expand/collapse on single record click. My code example:

private RecordClickHandler gatherRecordClickHandler() {
    return new RecordClickHandler() {

        @Override
        public void onRecordClick(RecordClickEvent event) {
            //Here i want to check if the record is expanded/collapsed
            if(/*expanded check method here*/)
                collapseRecord(event.getRecord());
            else
                expandRecord(event.getRecord());
        }
    };
}

Solution

  • Try this:

    if(myListGrid.isExpanded(event.getRecord))
        collapseRecord(event.getRecord());
    else
        expandRecord(event.getRecord());