Adobe

Sorting Preferences (List of DITA Topics) in AEM XML Web Editor Interface

Problem statement For editing the XML content AEM provides an XML web editor interface, where editors can edit content, add XML elements in the markup and refer one or more Darwin Information Typing Architecture(DITA) topics/articles in a DITA topic. Editors can navigate the preferences list and include it in the DITA topic. The out of […]

Vijay Kumar
Vijay Kumar
Read

Grails

Groovier way of sorting over multiple fields in a list of maps in groovy

Recently I was working on a Groovy and Grails Development project and had a requirement to sort multiple fields in a list of maps. I needed to sort the below list of maps by firstName, then by lastName and then by ascending age. It means first, the firstNames will be compared. If they are same, […]

raj
raj
Read

Grails

Alphanumeric Sorting using Criteria Query (with MySQL database)

I am working on a Grails application with MySQL database. I had a use case in which I had to implement alphanumeric sorting using Criteria Query on Grails. By alphanumeric sorting I mean if there is a class Employee with field empId then on doing : [plain] Employee e1 = new Employee(empId:’emp10′).save() Employee e2 = new […]

Gaurav Sharma
Gaurav Sharma
Read

Technology

Sorting in javascript

Recently in my project I needed to sort an object list on the basis of object name. For the same purpose I created the following function [java] function sortList(objList) { objList.sort(sortByName); } function sortByName(a, b) { var x = a.name; var y = b.name; return ((x < y) ? -1 : ((x > y) ? […]

Sachin
Sachin
Read

Grails

Groovy: Sort list of objects on the basis of more than one field

Usually, when we deal with databases, we don’t face such kind of situation because we query database to get result-set in required order. But let’s say you have a List of objects that you want to sort on the basis of two fields. Let’s discuss it with an example. I have a list of Tasks […]

Salil
Salil
Read