View source | Discuss this page | Page history | Printable version   
Toolbox
Main Page
Upload file
What links here
Recent changes
Help

PDF Books
Add page
Show collection (0 pages)
Collections help

Search

How to add a rich text field and column

Contents

Introduction

This howto explains how to add a rich text field and column to the Openbravo system.

The steps to get a rich text field in your window consists of 2 steps: 1) add a column to a table, and 2) add a field to a tab.

You can also create a new table and a new window/tab ofcourse. These 2 steps are described in detail in the following howtos:

This howto will only focus on the specific part of a rich text field.

Bulbgraph.png   Rich text fields are available in MP20 and later MPs.

Example Module

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

The example module adds a rich text field to the sales order header window. Please use an example module version of a release/implementation date of 23rd of January or later.

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

Bulbgraph.png   The example module also contains implementations of other howtos.

Adding a column

First, you have to add a new column to the existing table.

Bulbgraph.png   As rich text is stored as HTML inside the database, the varchar column type should be used. What is more, the developer needs to keep in mind that 100 characters of rich text requires more that 100 chars of storage inside the database due to html markup. Usually, a factor of 2 will suffice, for example, if one wants to allow the user to enter 1000 characters of rich formatted text, the database column should have a type of varchar(2000).

When introducing the new column to the application dictionary, the correct reference must be selected, i.e. the new Rich Text reference:

Howto-rich-text-column-reference.png

Create a field - set col and rowspan

Then create a field within the tab/window. For a rich text field you can also set the col and rowspan (these are only shown when the corresponding column is defined as rich text):


Howto-rich-text-field.png

The result

The result is visualized as a rich text editor in form view:


Howto-rich-text-result.png


Bulbgraph.png   For now rich text fields can not be edited in grid mode (a hoover shows the content). They are always displayed as read-only fields.

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

This page has been accessed 1,645 times. This page was last modified on 3 April 2013, at 14:06. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.