I wanted to be able to set a cellFormatter and then remove it, enabling the default formatting again. setCellFormatter does not let you do this and blows up when you pass it a null. This is the current code:
I think this could easily be fixed with
A workaround is to call
Code:
public native void setCellFormatter(CellFormatter formatter) /*-{
var self = this.@com.smartgwt.client.core.DataClass::getJsObj()();
self.formatCellValue = $debox($entry(function(value, record, rowNum, colNum) {
var recordJ = @com.smartgwt.client.widgets.grid.ListGridRecord::getOrCreateRef(Lcom/google/gwt/core/client/JavaScriptObject;)(record);
var valueJ = $wnd.SmartGWT.convertToJavaType(value);
return formatter.@com.smartgwt.client.widgets.grid.CellFormatter::format(Ljava/lang/Object;Lcom/smartgwt/client/widgets/grid/ListGridRecord;II)(valueJ, recordJ, rowNum, colNum);
}));
}-*/;
Code:
public native void setCellFormatter(CellFormatter formatter) /*-{
var self = this.@com.smartgwt.client.core.DataClass::getJsObj()();[b]
if (formatter==null)
self.formatCellValue = null;
else[/b]
self.formatCellValue = $debox($entry(function(value, record, rowNum, colNum) {
var recordJ = @com.smartgwt.client.widgets.grid.ListGridRecord::getOrCreateRef(Lcom/google/gwt/core/client/JavaScriptObject;)(record);
var valueJ = $wnd.SmartGWT.convertToJavaType(value);
return formatter.@com.smartgwt.client.widgets.grid.CellFormatter::format(Ljava/lang/Object;Lcom/smartgwt/client/widgets/grid/ListGridRecord;II)(valueJ, recordJ, rowNum, colNum);
}));
}-*/;
A workaround is to call
Code:
ListGridField.setAttribute("formatCellValue",(String)null);