View Full Version : How to sort a grid column with checkboxes?

24 Oct 2014, 10:33 AM
Hello all,

I am having a grid with multiple columns. One of the column is a checkbox column of xtype: 'checkcolumn'. I have something around 100 rows in this grid and for some of the rows the checkbox is checked and for some it is unchecked based on a value in the db. All the other columns in the grid which are string based sort correctly in either ascending or descending order when I click on their column headers. But for this particular column, when I click on the header nothing is happening. When I click on the header, I should get all those rows sorted based on like, if the checkbox is selected or not. I should either get those checked values to be on top of the list or at the end of the list.

xtype: 'checkcolumn',
header: "Old User",
disabled: true,
width: 170,
dataIndex: 'oldUser',
itemId: 'oldUser',
renderer: this.checkOldUser,
sortable: true

Please let me know what exactly I should be doing to make this sorting work.


24 Oct 2014, 12:14 PM
What kind of data is in oldUser? The store does the sorting, so if that raw data would not sort properly you may need to specify a sortType on the field.

If that doesn't help, perhaps you could put together a little fiddle (https://fiddle.sencha.com/#home).

24 Oct 2014, 12:33 PM
Thanks carol,

That helped. I was under the impression that I should do something at the view level to fix this. Now I defined the sorting mechanism at my model and it is working fine now.