Sorting for New button for multiple Cases in section page

How to sort the New button with multiple cases in section page.Like section page having multiple case pages, need to sort them based on the name field.



File attachments
Like 0





It's possible, the logic of the "converter" function of the "bindConfig" object of the "SeparateModeAddRecordButton" element of the BaseDataView should be modified:


The list of pages is returned in an "items" array of the editPages collection:


For example in my CaseSection section elements will be loaded in the following manner:

1) "Incident"
2) "Service request"
3) "Test cat 2"
4) "Test cat 1"

Because this is the set that is returned:



And indeed when the method ends its execution we can see that the list is loaded in the manner specified in the debugger:

You can override the method execution. In my example I've added this code to the CaseSection (in your case it should be AccountSectionV2) to the diff array of the schema and added additional logic to the method of logging the "Hello" word in the console when the method is executed:

                "operation": "merge",
                "name": "SeparateModeAddRecordButton",
                "propertyName": "items",
                "values": {
                    "itemType": Terrasoft.ViewItemType.BUTTON,
                    "caption": {"bindTo": "AddRecordButtonCaption"},
                    "click": {"bindTo": "addRecord"},
                    "visible": {"bindTo": "IsAddRecordButtonVisible"},
                    "classes": {
                        "textClass": ["actions-button-margin-right"],
                        "wrapperClass": ["actions-button-margin-right"]
                    "controlConfig": {
                        "menu": {
                            "items": {
                                "bindTo": "EditPages",
                                "bindConfig": {
                                    "converter": function(editPages) {
                                        if (editPages.getCount() > 1) {
                                            return editPages;
                                        } else {
                                            return null;
and it worked perfectly:



So what is needed to be done is to sort the items array inside of the editPages.collection object. This is more JS-side task rather than development on the Creatio platform so you will need to perform this sorting on your side.

Best regards,


Show all comments