1. #1
    Ext User
    Join Date
    Jan 2009
    Posts
    7
    Vote Rating
    0
    empl1_foo-inc is on a distinguished road

      0  

    Default [CLOSED] [1.2.2] HiddenChange and WidthChange Events not firing

    [CLOSED] [1.2.2] HiddenChange and WidthChange Events not firing


    I believe the HiddenChange and WidthChange events are not firing.


    Using Ext 1.2.2
    GWT 1.5.3
    Local host & hosted FF 3.0.1

    Code:
    import java.util.ArrayList;
    import java.util.List;
    import com.extjs.gxt.ui.client.Events;
    import com.extjs.gxt.ui.client.data.BaseModel;
    import com.extjs.gxt.ui.client.event.ColumnModelEvent;
    import com.extjs.gxt.ui.client.event.Listener;
    import com.extjs.gxt.ui.client.store.ListStore;
    import com.extjs.gxt.ui.client.widget.ContentPanel;
    import com.extjs.gxt.ui.client.widget.Info;
    import com.extjs.gxt.ui.client.widget.Viewport;
    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.google.gwt.core.client.EntryPoint;
    
    import com.google.gwt.user.client.ui.RootPanel;
    
    public class test implements EntryPoint {
    	private Listener columnListener;
    
    	public void onModuleLoad() {
    
    		List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
    
    		ColumnConfig column = new ColumnConfig();
    		column.setId("col1");
    		column.setHeader("col1");
    		column.setWidth(125);
    		column.setHidden(false);
    		configs.add(column);
    
    		column = new ColumnConfig();
    		column.setId("col2");
    		column.setHeader("col2");
    		column.setWidth(65);
    		column.setHidden(true);
    		configs.add(column);
    
    		List<BaseModel> data = new ArrayList<BaseModel>();
    
    		BaseModel row = new BaseModel();
    		row.set("col1", "data1");
    		row.set("col2", "data1");
    		data.add(row);
    
    		row = new BaseModel();
    		row.set("col1", "data2");
    		row.set("col2", "data2");
    		data.add(row);
    
    		ListStore<BaseModel> store = new ListStore<BaseModel>();
    		store.add(data);
    
    		Grid grid = new Grid(store, new ColumnModel(configs));
    
    		grid.getColumnModel().addListener(Events.HiddenChange, columnListener);
    
    		Viewport viewport = new Viewport();
    
    		ContentPanel cp = new ContentPanel();
    		cp.setSize(300, 300);
    		cp.add(grid);
    		viewport.add(cp);
    		RootPanel.get().add(viewport);
    
    		columnListener = new Listener<ColumnModelEvent>() {
    
    			public void handleEvent(ColumnModelEvent be) {
    				switch (be.type) {
    				case Events.HiddenChange:
    					Info.display("HiddenChange", "{0}" + be.colIndex);
    					break;
    				case Events.HeaderChange:
    					Info.display("Header Change", "{0}" + be.colIndex);
    					break;
    				case Events.WidthChange:
    					Info.display("Width Change", "{0}" + be.colIndex);
    			
    					break;
    				}
    			}
    
    		};
    
    	}
    
    }

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,966
    Vote Rating
    130
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    There is an issue with your code. This works fine:

    Code:
    List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
    
        ColumnConfig column = new ColumnConfig();
        column.setId("col1");
        column.setHeader("col1");
        column.setWidth(125);
        column.setHidden(false);
        configs.add(column);
    
        column = new ColumnConfig();
        column.setId("col2");
        column.setHeader("col2");
        column.setWidth(65);
        column.setHidden(true);
        configs.add(column);
    
        List<BaseModel> data = new ArrayList<BaseModel>();
    
        BaseModel row = new BaseModel();
        row.set("col1", "data1");
        row.set("col2", "data1");
        data.add(row);
    
        row = new BaseModel();
        row.set("col1", "data2");
        row.set("col2", "data2");
        data.add(row);
    
        ListStore<BaseModel> store = new ListStore<BaseModel>();
        store.add(data);
    
        final Grid grid = new Grid(store, new ColumnModel(configs));
    
        ContentPanel cp = new ContentPanel();
        cp.setSize(300, 300);
        cp.setLayout(new FitLayout());
        cp.add(grid);
    
        columnListener = new Listener<ColumnModelEvent>() {
    
          public void handleEvent(ColumnModelEvent be) {
            switch (be.type) {
              case Events.HiddenChange:
                Info.display("HiddenChange", "{0}" + be.colIndex);
                break;
              case Events.HeaderChange:
                Info.display("Header Change", "{0}" + be.colIndex);
                break;
              case Events.WidthChange:
                Info.display("Width Change", "{0}" + be.colIndex);
                break;
            }
          }
    
        };
    
        grid.getColumnModel().addListener(Events.HiddenChange, columnListener);
        grid.getColumnModel().addListener(Events.HeaderChange, columnListener);
        grid.getColumnModel().addListener(Events.WidthChange, columnListener);
    
        add(cp);
    
        add(new Button("Change Width", new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            grid.getColumnModel().setColumnWidth(0, 300);
          }
        }));
        
        add(new Button("Change Header", new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            grid.getColumnModel().setColumnHeader(0,"new Header");
          }
        }));

  3. #3
    Ext User
    Join Date
    Jan 2009
    Posts
    7
    Vote Rating
    0
    empl1_foo-inc is on a distinguished road

      0  

    Default Got it. Thanks.

    Got it. Thanks.


    Needed to move:
    grid.getColumnModel().addListener(Events.HiddenChange, columnListener);

    below:
    public void handleEvent(ColumnModelEvent be) {

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar