Guide
  • Introduction
  • Intro
    • Introduction
  • Beginner
    • How to send a param to another page
    • How to fill a select/combobox, radiolist, checkboxlist
    • How to order a list by a columm (java)
    • How to change the first page(home) of an application
  • Intermediate
    • How to make a filter/search with QueryInterface
    • How to hide a table context button?
    • How to show a file in a table
    • How to consume a JSON... GET and POST
    • How to make a SoapRequest
    • How to fill SeparatorList or FormList
    • How to map an entity to table using hibernate??
  • Advanced
    • OUT OF SERVICE - How to use a switch in a table - UI designer
    • How to implement a process BPMN in IGRP Studio
Powered by GitBook
On this page
  1. Beginner

How to order a list by a columm (java)

Let's imagine in a page called PartilhaGeral, that you have a List<> for type Partilhageral.Table_1

List<Partilhageral.Table_1> tablePart = new ArrayList<Partilhageral.Table_1>();

Steps to fill in you controller to order the list:

using lambda
tablePart.sort(Comparator.comparing(Partilhageral.Table_1::getEstado))

or

//In import reserved area:
import java.util.Collections;
import java.util.Comparator;

//In reserved code area after the set ot tablePart list add:
Collections.sort(tablePart,new SortbyStatus());

//At the end of your controller in custom_actions area add this class:
class SortbyStatus implements Comparator<Partilha.Table_1> {
        public int compare(Partilhageral.Table_1 a, Partilhageral.Table_1 b) {
            return b.getEstado() - a.getEstado();
        }
}

PreviousHow to fill a select/combobox, radiolist, checkboxlistNextHow to change the first page(home) of an application

Last updated 6 years ago