View source | Discuss this page | Page history | Printable version   

How to create a Multi Selector

Bulbgraph.png   Contents in this document are available from 3.0MP20

Contents

Introduction

Multi Selector is a reference that allows to select multiple items at the same time. It is intended to be used as parameter of Standard Process Definition.

Multi Selector reference is defined pretty much as regular selectors (which allow to select a single value). For more information about selectors take a look to this example.

Example Module

This howto is supported by an example module which shows examples of the code shown and discussed.

The code of the example module can be downloaded from this mercurial repository: https://code.openbravo.com/erp/mods/org.openbravo.client.application.examples/

The example module is available through the Central Repository (See 'Client Application Examples'), for more information see the Examples Client Application project page.

Steps to implement the Process

Overview

This howto explains how to create a Multi Order selector.

MultiSelector1.png
MultiSelector2.png

Defining the Selector

Adding fields to Selector's Pop Up

Last step is to define which are the fields that will be present in the popup to select records.

MultiSelectorAD1.png

Using the Selector

This selector can be used as parameter for a Process Definition. In this howto it is used.

Retrieving values in backend

In backend, the Java implementing the process, receives an JSONArray with the IDs of all selected rows. In case no row is selected, an empty array is received.

 
      //...
      JSONArray orders = params.getJSONArray("orders"); // get the array
     
 
      // iterate it
      for (int i = 0; i < orders.length(); i++) {
         // ...
      }

Advanced topics

Using custom query selector

When using a custom query to define the selector, there must be an alias in the query named _identifier which will be used as user readable identifier for the selected records and another one named id which will be sent to backend as id of the selected records. Fields for these query columns with the same names are also required.

Limitations

Multi Selectors can only be used as parameters in Standard Process Definition, they cannot be included in Standard Windows.

Retrieved from "http://wiki.openbravo.com/wiki/How_to_create_a_Multi_Selector"

This page has been accessed 12,520 times. This page was last modified on 30 January 2015, at 10:38. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.