1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    2
    Vote Rating
    0
    bitkopf is on a distinguished road

      0  

    Default How to enable SelectionMode.SIMPLE on CheckBoxSelectionModel in Grid?

    How to enable SelectionMode.SIMPLE on CheckBoxSelectionModel in Grid?


    Hi,
    i try to make multiple rows selectable through checkboxes in a grid without pressing Ctrl or Shift.
    I have extracted my problem by this test case:

    Code:
    public class Test implements EntryPoint{
    
        class Dummy extends BaseModel{
            public Dummy() {
                set("name", "Dummy" );
            }
        }
        
        @Override
        public void onModuleLoad() {
            
            ListStore<Dummy> store = new ListStore<Dummy>();
            store.add(new Dummy());
            store.add(new Dummy());
            
            List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
            
            CheckBoxSelectionModel<Dummy> sm = new CheckBoxSelectionModel<Dummy>();
            sm.setSelectionMode(SelectionMode.SIMPLE);
            columns.add(sm.getColumn());
            
            ColumnConfig cc = new ColumnConfig("name", 100);
            columns.add(cc);
            
            ColumnModel cm = new ColumnModel(columns);
            
            Grid<Dummy> grid = new Grid<Dummy>(store, cm);
    
            RootPanel.get().add(grid);
            
        }
    }
    "sm.setSelectionMode(SelectionMode.SIMPLE);" seems to be completely ignored. Why?

  2. #2
    Sencha User
    Join Date
    Feb 2012
    Posts
    10
    Vote Rating
    0
    storm8 is on a distinguished road

      0  

    Lightbulb Try This

    Try This


    i have the same problem and after few shot i solve problem using the following statement

    grid.setSelectionModel(sm);

    the object "sm" i create like follwing

    CheckBoxSelectionModel<YourModelData> sm = new CheckBoxSelectionModel<YourModelData>();
    sm.setSelectionMode(SelectionMode.MULTI);
    configs.add(sm.getColumn());

  3. #3
    Sencha User
    Join Date
    Nov 2009
    Posts
    51
    Vote Rating
    0
    smiletolead is on a distinguished road

      0  

    Default


    You need to add selection model to the grid as a selection model and a plugin. Add these two lines of code:

    Code:
    grid.setSelectionModel(sm);
    grid.addPlugin(sm);

  4. #4
    Sencha User
    Join Date
    Feb 2012
    Posts
    2
    Vote Rating
    0
    bitkopf is on a distinguished road

      0  

    Default


    Great. Thanks a lot!

    That seems very redundant.
    1. Pass the ColumnModel containing the SelectionModel to the grid in the constructor.
    2. Set the SelectionModel for the Grid.
    3. Add the SelectionModel as a plugin.

    Anyway i'm glad it works :-)

Thread Participants: 2

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