3

I am trying to access a sorted list of data on the basis of 'Description' which is a long text field type and it is throwing an exception on the VF page:

Cannot be filtered in query call

But when I create a view and sort the description column it works fine.

Just wanted to understand the logic behind this.

  • By view, do you mean list view? – Sam Dec 25 '14 at 10:03
  • thanks theGreatDanton, yes here view means list view. – Dildar Hussain Dec 25 '14 at 10:15
7

You cannot filter / sort SOQL queries using the Description fields as they are not filterable, e.g., check out the properties of the description field here for the case object. But if you want to sort by Description the only way I think you can do that is by implementing custom sort using the comparable interface. There is a post about it here

Another way is doing the sorting from the client side using javascript / jquery. There are a few good libraries which can be of help. One them being DataTable

  • Hi theGreatDanton and Mohit, Thanks for your suggestions on sorting the records but here i wanted to know if filter is not allowed then how salesforce standard list view works..... – Dildar Hussain Dec 26 '14 at 4:24
  • As far as I can tell list view sorting is handled internally by Salesforce and we do not have any visibility on how its done. But this is only my opinion :) – Sam Dec 26 '14 at 4:42
6

Apart from datatable if you are looking for other plugins to build using Visualforce,you should check Jqgrid plugin .

Jqgrid has lot more functionality than datatable and provides ability to filter ,sort and paginate

http://www.trirand.com/blog/jqgrid/jqgrid.html

The above gives different demo of this plugin and also the documentation around this good

http://www.trirand.com/jqgridwiki/doku.php?id=wiki:jqgriddocs#upgrading

The description fields are not sortable

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.