Article
How to sort records by date of modification in EntitySchemaQuery?
17:55 Feb 12, 2018
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); ...