1. #1
    Ext GWT Premium Member
    Join Date
    Jul 2009
    Posts
    80
    Vote Rating
    0
    terciofilho is on a distinguished road

      0  

    Default Grid Header ContextMenu disappear after column move

    Grid Header ContextMenu disappear after column move


    Hi!

    I use a ContextMenu in Grid's Header.

    After que Column Reorder in Grid the ContextMenu doesn't show up again.

    Procedure: Run the the test-case, right-click the column header, reorder the column and try to show the context menu again.

    Test-Case:
    Code:
    /**
     * Entry point classes define <code>onModuleLoad()</code>.
     */
    public class GxtTest implements EntryPoint {
    
    	/**
    	 * This is the entry point method.
    	 */
    	public void onModuleLoad() {
    		RootPanel rootPanel = RootPanel.get();
    		LayoutContainer cont = new GridExample();
    		rootPanel.add(cont);
    	}
    
    	class GridExample extends LayoutContainer {
    
    		private ColumnModel cm;
    
    		@Override
    		protected void onRender(Element parent, int index) {
    			super.onRender(parent, index);
    			setLayout(new FlowLayout(10));
    			getAriaSupport().setPresentation(true);
    
    			List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
    
    			ColumnConfig column = new ColumnConfig();
    			column.setId("name");
    			column.setHeader("Company");
    			column.setWidth(200);
    			column.setRowHeader(true);
    			configs.add(column);
    
    			column = new ColumnConfig();
    			column.setId("symbol");
    			column.setHeader("Symbol");
    			column.setWidth(100);
    			configs.add(column);
    
    			ListStore<Stock> store = new ListStore<Stock>();
    			store.add(TestData.getStocks());
    
    			cm = new ColumnModel(configs);
    
    			ContentPanel cp = new ContentPanel();
    			cp.setBodyBorder(true);
    			cp.setHeading("Basic Grid");
    			cp.setButtonAlign(HorizontalAlignment.CENTER);
    			cp.setLayout(new FitLayout());
    			cp.getHeader().setIconAltText("Grid Icon");
    			cp.setSize(300, 300);
    
    			final Grid<Stock> grid = new Grid<Stock>(store, cm);
    			grid.setAutoExpandColumn("name");
    			grid.setBorders(false);
    			grid.setStripeRows(true);
    			grid.setColumnLines(true);
    			grid.setColumnReordering(true);
    			cp.add(grid);
    
    			grid.addListener(Events.Attach, new Listener<BaseEvent>() {
    				@Override
    				public void handleEvent(BaseEvent be) {
    					Menu contextMenu = new Menu();
    					contextMenu.add(new MenuItem("ContextMenu Option"));
    					grid.getView().getHeader().setContextMenu(contextMenu);
    				}
    			});
    
    			add(cp);
    		}
    
    	}
    
    	@SuppressWarnings("serial")
    	public static class Stock extends BaseModelData {
    	}
    
    	static class TestData {
    
    		public static List<Stock> getStocks() {
    
    			List<Stock> stockList = new ArrayList<Stock>();
    			Stock stock1 = new Stock();
    			stock1.set("name", "name");
    			stock1.set("symbol", "symbol");
    			stock1.set("date", new Date());
    			stockList.add(stock1);
    
    			return stockList;
    		}
    
    	}
    }

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    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


    This is not a bug. The issue is in your code.
    Code:
     class GridExample extends LayoutContainer {
    
          private ColumnModel cm;
    
          @Override
          protected void onRender(Element parent, int index) {
            super.onRender(parent, index);
            setLayout(new FlowLayout(10));
            getAriaSupport().setPresentation(true);
    
            List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
    
            ColumnConfig column = new ColumnConfig();
            column.setId("name");
            column.setHeader("Company");
            column.setWidth(200);
            column.setRowHeader(true);
            configs.add(column);
    
            column = new ColumnConfig();
            column.setId("symbol");
            column.setHeader("Symbol");
            column.setWidth(100);
            configs.add(column);
    
            ListStore<Stock> store = new ListStore<Stock>();
            store.add(getStocks());
    
            cm = new ColumnModel(configs);
    
            ContentPanel cp = new ContentPanel();
            cp.setBodyBorder(true);
            cp.setHeading("Basic Grid");
            cp.setButtonAlign(HorizontalAlignment.CENTER);
            cp.setLayout(new FitLayout());
            cp.getHeader().setIconAltText("Grid Icon");
            cp.setSize(300, 300);
    
            final Grid<Stock> grid = new Grid<Stock>(store, cm);
            grid.setAutoExpandColumn("name");
            grid.setBorders(false);
            grid.setStripeRows(true);
            grid.setView(new GridView(){
              @Override
              protected ColumnHeader newColumnHeader() {
                
                ColumnHeader h= super.newColumnHeader();
                Menu contextMenu = new Menu();
                contextMenu.add(new MenuItem("ContextMenu Option"));
                h.setContextMenu(contextMenu);
                return h;
                
              }
            });
            grid.setColumnLines(true);
            grid.setColumnReordering(true);
            cp.add(grid);
    
         
    
            add(cp);
          }
    
        }

Similar Threads

  1. Move Column Menu Header from right to left
    By rakesur in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 6 Oct 2009, 10:43 PM
  2. Mouse Enter Grid, column header disappear in IE
    By chinadust in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 13 Apr 2009, 11:18 PM
  3. move column selector out of column header?
    By bcamp1973 in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 9 May 2008, 1:32 PM
  4. remove contextmenu on header of grid
    By GoHabsGo2 in forum Ext 2.x: Help & Discussion
    Replies: 8
    Last Post: 29 Jan 2008, 8:21 AM

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi