After upgrading to SmartGWT 4.0, I am seeing a render issue with list grids and columns that use an image. When a row is added or removed, one or more rows in the list grid will have a missing image.
To re-create this issue, I have altered the Smart GWT Showcase file "GridCellWidgetsSample.java". This sample code creates a list grid with 2 columns (name and edit image/button). Below the list grid is an "add button" which inserts a new list grid row (using either "Bob" or "Joe" as the name).
To re-create the issue:
1) press the "add button" (e.g. add 3 rows to list grid). Everything is fine at this point.
2) sort the list grid in descending order by pressing on the "Name" column header
3) press the "add button" and you will see some of the new rows will have the missing image in the "edit column"
Note that this did not happen on SmartGWT 3.1. I tried SmartGWT 4.1d and the same problem occurred.
Info:
1) SmartGWT version: SmartGWT 4.0p from 12-12-13
2) Browser: Chrome 31.0.1650.63
3) Sample Code below
To re-create this issue, I have altered the Smart GWT Showcase file "GridCellWidgetsSample.java". This sample code creates a list grid with 2 columns (name and edit image/button). Below the list grid is an "add button" which inserts a new list grid row (using either "Bob" or "Joe" as the name).
To re-create the issue:
1) press the "add button" (e.g. add 3 rows to list grid). Everything is fine at this point.
2) sort the list grid in descending order by pressing on the "Name" column header
3) press the "add button" and you will see some of the new rows will have the missing image in the "edit column"
Note that this did not happen on SmartGWT 3.1. I tried SmartGWT 4.1d and the same problem occurred.
Info:
1) SmartGWT version: SmartGWT 4.0p from 12-12-13
2) Browser: Chrome 31.0.1650.63
3) Sample Code below
Code:
private int count = 0; public Canvas getViewPanel() { final VStack stack = new VStack(8); stack.setWidth100(); stack.setHeight100(); final ListGrid countryGrid = new ListGrid() { @Override protected Canvas createRecordComponent(final ListGridRecord record, Integer colNum) { String fieldName = this.getFieldName(colNum); if (fieldName.equals("Edit-ID")) { HLayout recordCanvas = new HLayout(3); recordCanvas.setWidth(24); recordCanvas.setHeight(24); recordCanvas.setAlign(Alignment.CENTER); ImgButton editImg = new ImgButton(); editImg.setShowDown(false); editImg.setShowRollOver(false); editImg.setLayoutAlign(Alignment.CENTER); editImg.setSrc("US.png"); editImg.setHeight(24); editImg.setWidth(24); recordCanvas.addMember(editImg); return recordCanvas; } else { return null; } } }; countryGrid.setShowRecordComponents(true); countryGrid.setShowRecordComponentsByCell(true); countryGrid.setWidth(400); countryGrid.setHeight(300); countryGrid.setShowAllRecords(true); ListGridRecord[] recordList = new ListGridRecord[2]; ListGridRecord record1 = new ListGridRecord(); record1.setAttribute("Name-ID", "Bob"); record1.setAttribute("Edit-ID", ""); recordList[0] = record1; ListGridRecord record2 = new ListGridRecord(); record2.setAttribute("Name-ID", "Joe"); record2.setAttribute("Edit-ID", ""); recordList[1] = record2; ListGridField nameField = new ListGridField("Name-ID", "Name"); nameField.setWidth(350); ListGridField editField = new ListGridField("Edit-ID", "Edit"); editField.setWidth(32); countryGrid.setFields(nameField, editField); stack.addMember(countryGrid); IButton addButton = new IButton("Add Test"); addButton.setWidth(150); addButton.setHeight(32); addButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent _event) { ListGridRecord record = new ListGridRecord(); if (count++ % 2 == 0) { record.setAttribute("Name-ID", "Jack"); } else { record.setAttribute("Name-ID", "Bob"); } record.setAttribute("Edit-ID", ""); countryGrid.addData(record); } }); stack.addMember(addButton); return stack; }
Comment