Question

Sort objects - server side

Hi community,

 

I've got one use case where I need to present the products in the catalogue shopping cart ordered by a custom column called "sequence".

 

I was expecting that if I defined the "Sorting in Lists" in the configuration of the object to this "sequence" column it would work but it is not.

 

I also could not find a description  of the "Sorting in Lists" parameter to be sure of what is the expected behaviour.

 

We have in the meantime developed some code in the page to do the sorting but I was hoping to find a server side solution that would easily achieve the task.

 

Any ideas?

Thanks

Like 0

Like

3 comments

Hi Luis,

 

Thank you for your question!

Before I can answer you, can you please specify why the sorting that is present and/or developed on the page doesn't work for you? Is there are any specific conditions or tasks you are trying to achieve?

 

Best regards,

Bogdan S.

 

 

 

Bogdan Spasibov,

 

 

Hi Bogdan,

 

The costumer is importing long lines of products in quotes that have to appear in the order that they are imported to later create documents in this specific order.

These orders can have hundreds of lines.

They are using the shopping cart to view and check all products added to the order and the sequence by which the products appead is important. In this case the default behaviour I believe is alphabetical.

 

Thanks,

Luis

Hi Luis,

 

Please see the example of the method that sorts records on their creation date:

getGridDataColumns: function() {
            return {
              "UsrCase":{path:"UsrCase"},
              "CreatedOn":{path:"CreatedOn", orderPosition:0, orderDirection:Terrasoft.OrderDirection.ASC},
              "UsrName":{path:"UsrName"}
            }
          },

This method was then called in the init function:

methods: {
          init: function() {
                this.callParent(arguments);
            	this.getGridDataColumns();
            },

As a result each time the detail is initialized on the page the method is being called and all the records are sorted by their creation date (please note that there is no sorting icon on any column of the detail at the bottom):

Please use the same approach on your end as well (the sorting should be applied to the detail schema).

 

Best regards,

Oscar

Show all comments