Yes 100% sure, it is simply making a call to the javascript method that exists in ListGrid.js but needs to first get the ListGrid object which contains the method. What is your exception your getting? Here is the code, make sure you have the same. *(of course had to make my own records)
Code:
public class MultiSelectCriteiraGrid extends ListGrid { public static final String FIELD_ID = "id"; public static final String FIELD_PID = "pid"; public static final String FIELD_VALUE = "value"; public MultiSelectCriteiraGrid(final String title) { setWidth(220); setShowAllRecords(true); setAlternateRecordStyles(true); setLeaveScrollbarGap(false); setSelectionType(SelectionStyle.SIMPLE); setSelectionAppearance(SelectionAppearance.CHECKBOX); setCanSelectAll(true); final ListGridField fieldId = new ListGridField(FIELD_ID); fieldId.setHidden(true); final ListGridField parentId = new ListGridField(FIELD_PID); parentId.setHidden(true); final ListGridField fieldName = new ListGridField(FIELD_VALUE, title); fieldName.setCanSort(false); fieldName.setCanGroupBy(false); fieldName.setCanHide(false); fieldName.setCanDragResize(false); setFields(fieldId, parentId, fieldName); } public void populateData() { ListGridRecord[] d = new ListGridRecord[3]; for (int i = 0; i < 3; i++) { d[i] = new ListGridRecord(); d[i].setAttribute("id", Random.nextInt()); d[i].setAttribute("pid", Random.nextInt()); } setData(d); } public native void _setCheckboxHeaderState(boolean state) /*-{ var self = this.@com.smartgwt.client.widgets.BaseWidget::getOrCreateJsObj()(); self._setCheckboxHeaderState(state); }-*/; } public void onModuleLoad() { final MultiSelectCriteiraGrid g = new MultiSelectCriteiraGrid("TITLE"); g.populateData(); g.addDrawHandler(new DrawHandler() { @Override public void onDraw(DrawEvent event) { g.selectAllRecords(); g._setCheckboxHeaderState(true); } }); g.draw(); }
Comment