cancel
Showing results for 
Search instead for 
Did you mean: 

CRM WEB UI : Collection Sorting issue/Assignment block sorting issue.

Former Member
0 Kudos
487

Hi Experts,

Can you please help me to resolve the below issue:

We have two assignments blocks which are available on the Accounts Over view page. We want to sort  records of first assignment block on some field zfield1 which is a zfield, and the same is with another assignment block also, where the records are to be sorted on another zfield ZFIELD2.  Each assignment is assigned to a different UI Configuration.

I have written code in DO_PREPARE_OUTPUT method of the view, where I have sorted the collections using :

CALL METHOD COLL_WRAPPER->IF_BOL_BO_COL~SORT
       EXPORTING
         IV_ATTR_NAME         = 'ZFIELD1'
         IV_SORT_ORDER        = cl_bsp_wd_collection_wrapper=>sort_descending.

The same is repeated for another assignment block also, which is assigned to a different UI Configuration with zfield ZFIELD2.

The sorting is working fine for the second assignment block. But in case of the first assignment block, on load of the page the sorting is not happening,

but when we click on the back button available on the over view page and once again come back to the over view page by selecting the account (which was a result of a search) now the sorting is working fine for the first assignment block also. and in any case there is no problem with sorting of the second assignment block.

I am not getting where it went wrong,  Please correct whether DO_PREPARE_OUTPUT is the correct place to do the sorting or is there any other method where we can sort the collection or any other technique available to achieve the same.

Thanks in Advance!!

Regards

Srinivasa Reddy

Accepted Solutions (1)

Accepted Solutions (1)

nicolas_busson
Active Contributor
0 Kudos

Hi,

If you sort your collection in the DO_PREPARE_OUTPUT method, then you need to implement some special logic to be sure that automatic sorting is happening on the first time the component is loaded only.. otherwise end users won't be able to use another criteria to sort the table.

So even if this is doable, why don't you sort your collection at the time of retrieval? (usually in the ON_NEW_FOCUS of your context node).

Regards,

Nicolas.

Former Member
0 Kudos

Thanks for your help, It solved my Problem.

Answers (0)