CheckboxSelectionModel in ExtJS grid

I’ve tried to use CheckboxSelectionModel on grid, and there are no examples in documents for. It’s not clear in documentation. Ok, so you should create CheckboxSelectionModel object before it’s passing to grid as selModel, because you should specify it in columns config property. So there is example by the steps.

  1. Create CheckboxSelectionModel:
var sm = new Ext.grid.CheckboxSelectionModel();
  1. Include created object in columns list:
columns:[

sm,


{..... rest of your columns .....}

]

  1. Provide selectionModel object as current selection model for grid. You should provide selModel property in config options:
selMode: sm

Result:


3 comments so far

  1. iamdanw on

    Thank you for posting this. I was stumped by CheckboxSelectionModel but it turns out it should be added to the column definition too.

  2. aitplus on

    Thank you very much. Helped my a lot.

    :) already searching for more than hour why the check box selection model does not show up. Key is to use the ’sm’ as a column.


Leave a reply

You must be logged in to post a comment.