View Full Version : [FIXED] Grid RowNumberer is not ordered

1 Sep 2008, 5:43 AM

When you sort a Grid (left click on a column header) and you update the store, the "RowNumberer" is not ordered.

You can try this :

package test.client;
import java.util.ArrayList;
import java.util.List;
import com.extjs.gxt.ui.client.Style.SelectionMode;
import com.extjs.gxt.ui.client.data.BaseModel;
import com.extjs.gxt.ui.client.event.ComponentEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.grid.RowNumberer;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Random;
import com.google.gwt.user.client.ui.RootPanel;

public class App implements EntryPoint {

public void onModuleLoad() {

List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
configs.add(new RowNumberer());
configs.add(new ColumnConfig("c1", "Column 1", 150));
configs.add(new ColumnConfig("c2", "Column 2", 150));
ColumnModel cm = new ColumnModel(configs);

final Grid<MyModel> grid = new Grid<MyModel>(new ListStore<MyModel>(), cm);
grid.setSize(354, 300);

RootPanel.get().add(new Button("Update store", new SelectionListener<ComponentEvent>(){
public void componentSelected(ComponentEvent ce){

private final static void fillStore(ListStore<MyModel> store) {
for (int i = 0; i < Random.nextInt(20) + 20; i++) {
store.add(new MyModel(Random.nextInt(999) + 1000, Random.nextInt(999) + 1000));
public static class MyModel extends BaseModel {
public MyModel(int value1, int value2) {
set("c1", value1);
set("c2", value2);

Click on one of the column header to sort the grid
Click on "update store" button
Look at the "RowNumberer" columnMy config :
Windows XP
Host mode / EclipseThanks,

1 Sep 2008, 6:20 AM
Yes indeed. I tested the code and the column numbers get all screwed up. I'm running Linux and the hosted mode has another problem (that may not appear in the real browser): the scrolling action and the button get on top of each other (for lack of a better description) and start flickering. I hope this is only because of the aged browser, but still...
Grid seems to be a very very large piece of code in the library, and it's only natural to have problems (and the forums are full of Grid problems). Hope they get solved soon.

4 Dec 2008, 4:22 PM
Also, if you delete a row, the RowNumberer is not re-ordered.

11 Dec 2008, 4:25 PM
This was not a bug. The class documents that row numbers will not be updated automatically. That being said, RowNumberer has been updated to update when the store changes. RowNumberer is now a ComponentPlugin, so you will need to call addPlugin on grid and pass the numberer to get automatic updates.

Change is in SVN.