1. #1
    Sencha User
    Join Date
    Sep 2009
    Posts
    287
    Vote Rating
    0
    diegolovison is on a distinguished road

      0  

    Default grid + selection; before render..

    grid + selection; before render..


    if needed select one item in a grid before render.. I try the code below... but dont have success...
    its correct?

    p.s.: if you click in the first line in the grid, will see that the item cannot more selected..

    xp
    hosted mode
    gxt 2.0.1
    gwt 1.7.0

    Code:
            final List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
    
            ColumnConfig column = new ColumnConfig();
            column.setId("name");
            column.setHeader("Company");
            column.setWidth(200);
            configs.add(column);
    
            column = new ColumnConfig();
            column.setId("symbol");
            column.setHeader("Symbol");
            column.setWidth(100);
            configs.add(column);
    
            column = new ColumnConfig();
            column.setId("last");
            column.setHeader("Last");
            column.setAlignment(HorizontalAlignment.RIGHT);
            column.setWidth(75);
            configs.add(column);
    
            column = new ColumnConfig("change", "Change", 100);
            column.setAlignment(HorizontalAlignment.RIGHT);
            configs.add(column);
    
            column = new ColumnConfig("date", "Last Updated", 100);
            column.setAlignment(HorizontalAlignment.RIGHT);
            column.setDateTimeFormat(DateTimeFormat.getShortDateFormat());
            configs.add(column);
    
            final ListStore<Stock> store = new ListStore<Stock>();
            store.add(TestData.getStocks());
    
            final ColumnModel cm = new ColumnModel(configs);
    
            final ContentPanel cp = new ContentPanel();
            cp.setBodyBorder(false);
            cp.setHeading("Basic Grid");
            cp.setButtonAlign(HorizontalAlignment.CENTER);
            cp.setLayout(new FitLayout());
            cp.setSize(600, 300);
    
            final Grid<Stock> grid = new Grid<Stock>(store, cm);
            grid.setStyleAttribute("borderTop", "none");
            grid.setAutoExpandColumn("name");
            grid.setBorders(true);
            grid.setStripeRows(true);
            grid.getSelectionModel().select(0, true);
            cp.add(grid);
    
            RootPanel.get().add(cp);

  2. #2
    Sencha User
    Join Date
    Sep 2009
    Posts
    287
    Vote Rating
    0
    diegolovison is on a distinguished road

      0  

    Default


    in the method processRows in the GridView, should be verify if the row was selected.. its one ideia..

  3. #3
    Sencha User
    Join Date
    Sep 2009
    Posts
    287
    Vote Rating
    0
    diegolovison is on a distinguished road

      0  

    Default


    this work fine

    Code:
        @Override
        public void onModuleLoad() {
    
            final List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
    
            ColumnConfig column = new ColumnConfig();
            column.setId("name");
            column.setHeader("Company");
            column.setWidth(200);
            configs.add(column);
    
            column = new ColumnConfig();
            column.setId("symbol");
            column.setHeader("Symbol");
            column.setWidth(100);
            configs.add(column);
    
            column = new ColumnConfig();
            column.setId("last");
            column.setHeader("Last");
            column.setAlignment(HorizontalAlignment.RIGHT);
            column.setWidth(75);
            configs.add(column);
    
            column = new ColumnConfig("change", "Change", 100);
            column.setAlignment(HorizontalAlignment.RIGHT);
            configs.add(column);
    
            column = new ColumnConfig("date", "Last Updated", 100);
            column.setAlignment(HorizontalAlignment.RIGHT);
            column.setDateTimeFormat(DateTimeFormat.getShortDateFormat());
            configs.add(column);
    
            final ListStore<Stock> store = new ListStore<Stock>();
            store.add(TestData.getStocks());
    
            final ColumnModel cm = new ColumnModel(configs);
    
            final EventType BeforeProcessRows = new EventType();
    
            final GridView view = new GridView() {
                @Override
                protected void processRows(final int startRow, final boolean skipStripe) {
                    super.processRows(startRow, skipStripe);
                    grid.fireEvent(BeforeProcessRows);
                }
            };
    
            final Grid<Stock> grid = new Grid<Stock>(store, cm);
            grid.setStyleAttribute("borderTop", "none");
            grid.setAutoExpandColumn("name");
            grid.setBorders(true);
            grid.setStripeRows(true);
            grid.setView(view);
            grid.addListener(BeforeProcessRows, new Listener<BaseEvent>() {
                @Override
                public void handleEvent(final BaseEvent be) {
                    grid.getSelectionModel().select(0, true);
                }
            });
    
            final ContentPanel cp = new ContentPanel();
            cp.setBodyBorder(false);
            cp.setHeading("Basic Grid");
            cp.setButtonAlign(HorizontalAlignment.CENTER);
            cp.setLayout(new FitLayout());
            cp.setSize(600, 300);
            cp.add(grid);
    
            RootPanel.get().add(cp);
        }

  4. #4
    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


    This feature was already added to 2.0.2

  5. #5
    Sencha User
    Join Date
    Sep 2009
    Posts
    287
    Vote Rating
    0
    diegolovison is on a distinguished road

      0  

    Default



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