How to sort records by date of modification in EntitySchemaQuery?

Question

How to sort records by date of modification in EntitySchemaQuery?

Answer

If the question concerns client logic, sorting can be set as follows:

var entitySchemaQuery = Ext.create("Terrasoft.EntitySchemaQuery", {
        rootSchemaName: entitySchemaName
});
var modifiedOnColumn = entitySchemaQuery.addColumn("ModifiedOn", "ModifiedOn");
modifiedOnColumn.orderPosition = 0;
modifiedOnColumn.orderDirection = Terrasoft.OrderDirection.ASC;
...

For the server logic:

var query = new EntitySchemaQuery(entitySchema);
var modifiedOnColumn = query.AddColumn("ModifiedOn");
modifiedOnColumn.OrderByAsc(0);
...

 

Like 1

Like

Share

0 comments
Show all comments