Scroll Top

Adding a checkbox in a GridPanel

Getting your Trinity Audio player ready...

Since you are trying to add a checkbox (probably in the beginning of the grid itself) in a GridPanel, it is obvious that you want to use a custom selection model, CheckboxSelectionModel. By looking at GridPanel’s API you quickly realize that you need to set value of selModel with an instance of CheckboxSelectionModel. So, you write following code:

 

Once you launch your application, you realize that nothing happened. This is where lack of ExtJS documentation hurts you. It never explicitly talks about defining a column, in the column list, which has a value of selection model object. Following piece of code works just alright:

 

Above code adds a check box in the beginning of every row. You can switch position of check box by placing the selection model object at desired position in the column list. For example, if you want to see checkbox in the middle of doctor name and hospital name then place the object between these two columns.

Related Posts

Leave a comment

Privacy Preferences
When you visit our website, it may store information through your browser from specific services, usually in form of cookies. Here you can change your privacy preferences. Please note that blocking some types of cookies may impact your experience on our website and the services we offer.