Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Polish

Podstawowe informacje

 Formularz zadania

udostępnia ServiceFactory jest dostępny

udostępnia API, które ułatwia wykonywanie podstawowych operacji na potrzeby dostosowania go do potrzeb klienta.

API zawiera ServiceFactory, który jest zbiorem serwisów odpowiedzialnych za poszczególne komponenty formularza.

Serwisy

Wszystkie serwisy są dostępne bezpośrednio na globalnym scope (

window).

 

Serwisy

ServiceFactory daje dostęp do następujących serwisów:

...

na podstawie ich nazwy) - od wersji systemu 3.2.5 lub do poprania za pomocą ServiceFactory.

  • ActivityInfoService - odpowiedzialny za przechowywanie podstawowych informacji o zadaniu, dostępny z globalnego scope za pomocą wywołania:

 

Code Block
languagejavascript
var activityInfoService = ServiceFactory.getActivityInfoService();

...


  • CommentService - odpowiedzialny za komentarze zadania, dostępny z globalnego scope za pomocą wywołania:
Code Block
languagejavascript
var commentsService = ServiceFactory.getCommentsService();

 

  • FormService - odpowiedzialny za zakładkę formularza ze zmiennymi formularza, dostępny z globalnego scope za pomocą wywołania:
Code Block
languagejavascript
var formService = ServiceFactory.getFormService();

 

  • MessageService - odpowiedzialny za wyświetlanie wiadomości w postaci animowanych "chmurek" dla użytkownika aktualnie korzystającego z formularza, dostępny z globalnego scope za pomocą wywołania:
Code Block
languagejavascript
var messageService = ServiceFactory.getMessageService();

 

  • VariableService - odpowiedzialny za zarządzanie zmiennymi formularza nie znajdującymi się w tabelach dynamicznych, dostępny z globalnego scope za pomocą wywołania:
Code Block
languagejavascript
var variableService = ServiceFactory.getVariableService();

 

  • VariableSetService - odpowiedzialny za zarządzanie tabelami dynamicznymi i zmiennymi znajdującymi się w nich, dostępny z globalnego scope za pomocą wywołania:
Code Block
languagejavascript
var variableSetService = ServiceFactory.getVariableSetService();

SuncodeFormService

API formularza posiada także dodatkowy serwis SuncodeFormService. Jest on również dostępny

na globalnym

na globalnym scope (window) i jest obsługiwany niezależnie od pozostałych serwisów.


Zdarzenia gotowości formularza

Funkcja addOnReadyEvent daje możliwość dodania dowolnej ilości akcji, jakie zostaną

wykonane

wykonane po zbudowaniu formularza (wszystkie komponenty na formularzu będą już dostępne). Funkcja ta ma

nazwę

nazwę addOnReadyEvent. Przykładowe wykorzystanie jest następujące:

Code Block
languagejavascript
SuncodeFormService.addOnReadyEvent( function() {
 alert( 'Pierwsza akcja' );
} );

SuncodeFormService.addOnReadyEvent( function() {
 alert( 'Druga akcja' );
} );

Użycie serwisu w powyższy sposób spowoduje, że po zbudowaniu formularza zostaną kolejno wyświetlone wiadomości: 'Pierwsza akcja' i 'Druga akcja'. Kolejność wykonywania akcji jest zależna od ładowania skryptów, a w ramach jednego pliku od kolejności dodawania akcji.

 

Funkcja

Funkcja addOnReadyEvent

przyjmuje

 przyjmuje jeden parametr:

  • event (typ Function) - funkcja JavaScript wykonana po zbudowaniu formularza

Funkcja ta nie zwraca żadnych rezultatów.

 

Grupowanie akcji obliczania wyglądu formularza

Od

wersji

wersji 3.1.6 możliwe jest dodatkowe grupowanie akcji zmieniających układ formularza (layout). Takie grupowanie zmian układu jest znacznie szybsze

niż

 niż wykonywanie tych akcji osobno.

Code Block
languagejavascript
SuncodeFormService.suspendLayouts();
try {
	// wiele akcji
	variableService.hide('a');
	variableSetService.hide('a');
}
finally {
	SuncodeFormService.resumeLayouts();
}


Od wersji 3.1.22

możliwe

 możliwe jest wywołanie grupowych akcji bez konieczności użycia bloków try

oraz 

 oraz finally

poprzez

 poprzez podanie parametrów w wywołaniu. W miejsce function

należy

 należy podać funkcje, która zostanie wywołana, a następnie scope

wywołania

 wywołania tej funkcji.

Code Block
SuncodeFormService.suspendLayouts(function, scope);

 

Ustawienia konfiguracyjne formularza

W wersji 3.1.10 wprowadzono mechanizm ustawień formularza. Umożliwia on dynamiczne ustawienie danych właściwości poprzez API:

Code Block
languagejavascript
// ustawienie właściwości
SuncodeFormService.setConfig('config.key', 'value');
 
// pobranie właściwości
var conf = SuncodeFormService.getConfig('config.key');
 
// można także sprecyzować wartość domyślną, zwróconą w przypadku, gdy właściwość nie zostanie ustawiona
var conf = SuncodeFormService.getConfig('config.key', 'default value');


Tabela zawiera wszystkie dostępne opcje konfiguracyjne formularza

 

NazwaTypWartość domyślnaDostępne odOpis
autoupdate.blurifchange
Boolean
false
3.1.10

Domyślnie AutoUpdate na zdarzeniu blur wykonuje się zawsze, nawet wtedy, gdy nie zmienimy wartości pola.

Aby AutoUpdate był wywoływany po wyjściu z pola, jeżeli jego wartość zmieniła się od wejścia w to pole należy wywołać kod:

Code Block
languagejavascript
SuncodeFormService.setConfig('autoupdate.blurifchange', true);


variableset.copyrow.target
String
bottom
3.1.13

Dopuszczalne wartości: bottom, below

Aby kopiowany wiersz wstawiony został poniżej zaznaczonego należy wywołać kod:

Code Block
languagejava
SuncodeFormService.setConfig('variableset.copyrow.target', 'below');

Jeżeli nie ustawiono tej opcji lub została ona ustawiona na 'bottom' kopiowany wiersz zostanie dodany na dole tabeli.

variable.variabletoview.genericformat
Boolean
false
3.2.0

Domyślnie dla zmiennych nieedytowalnych funkcja:

Code Block
languagejs
VariableService.getValue('id');
// lub
VariableService.getValue('id', false);

Zwraca zmienne typu całkowitego, zmiennoprzecinkowego, kwotowego, datowego i "data i czas" w formacie tekstowym.

Aby zmienne liczbowe i datowe zwracane były w odpowiadającym im typie języka JavaScript:

  • całkowity, zmiennoprzecinkowy, kwotowy - number
  • datowy, data i czas - date

Należy wywołać kod:

Code Block
languagejs
SuncodeFormService.setConfig('variable.variabletoview.genericformat', true);
English

Basic information

 The task form provides an API that facilitates basic operations for adapt it to the client's needs.

Services

All services are available directly on the global scope (based on their name) - from the system version 3.2.5 or to be download by ServiceFactory.

  • ActivityInfoService- responsible for storing basic information about the task, available from the global scope using a call:
Code Block
languagejavascript
var activityInfoService = ServiceFactory.getActivityInfoService();


  • CommentService- responsible for task comments, available from the global scope using a call:
Code Block
languagejavascript
var commentsService = ServiceFactory.getCommentsService();

 

  • FormService- responsible for the form tab with form variables, available from the global scope using a call:
Code Block
languagejavascript
var formService = ServiceFactory.getFormService();

 

  • MessageService- responsible for displaying messages in the form of animated "clouds" for the user currently using the form, available from the global scope using a call:
Code Block
languagejavascript
var messageService = ServiceFactory.getMessageService();

 

  • VariableService- responsible for managing form variables that are not in dynamic tables, available from the global scope using a call:
Code Block
languagejavascript
var variableService = ServiceFactory.getVariableService();

 

  • VariableSetService- responsible for managing dynamic tables and variables located in them, available from the global scope using a call:
Code Block
languagejavascript
var variableSetService = ServiceFactory.getVariableSetService();

 

SuncodeFormService

The API form also has an additional SuncodeFormService service. It is also available on the global scope (window) and is supported independently of other services.

Form readiness events 
 

The addOnReadyEvent function gives ability to add any actions number that will be taken after the form has been built (all components on the form will be available). This function is called addOnReadyEvent. The exemple use is as follows:

Code Block
languagejavascript
SuncodeFormService.addOnReadyEvent( function() {
 alert( 'First action' );
} );

SuncodeFormService.addOnReadyEvent( function() {
 alert( 'Second action' );
} );

Using the service in the above way will result in the following messages being displayed successively after the form has been built: 'First action' and 'Second action'. The order in which actions are performed depends on the scripts loading, and within one file, from the order of adding actions.


Function addOnReadyEvent takes one parameter:

  • event (Function type) - function JavaScript made after building the form 

This function does not return any results.

Grouping actions to calculate the appearance of a form 

From version 3.1.6 it is possible to additional group actions changing the layout of the form (layout). Such grouping of layout changes is much fasterthan performing these actions separately.

Code Block
languagejavascript
SuncodeFormService.suspendLayouts();
try {
	// many actions
	variableService.hide('a');
	variableSetService.hide('a');
}
finally {
	SuncodeFormService.resumeLayouts();
}


From version 3.1.22it is possible to call group actions without using tryand finally blocks by specifying parameters in the call. Instead of the function, you must specify the function which will be called, and then the scope of calling this function

Code Block
SuncodeFormService.suspendLayouts(function, scope);
Configuration settings for the form 
 

In version 3.1.10 form setting mechanism has been introduced. It allows dynamic setting of property data through the API: 

Code Block
languagejavascript
// setting property 
SuncodeFormService.setConfig('config.key', 'value');
 
// getting property
var conf = SuncodeFormService.getConfig('config.key');
 
// you can also specify a default value, returned if the property is not set
var conf = SuncodeFormService.getConfig('config.key', 'default value');


The table contains all available configuration options for the form

Name

Type

Default value

Available from

Description

autoupdate.blurifchange
Boolean
false
3.1.10

By default, AutoUpdate is always performed on a blur event, even if you do not change the field value

In order for AutoUpdate to be called after leaving the fieldif its value has changed since entering this field, the code should be called:

Code Block
languagejavascript
SuncodeFormService.setConfig('autoupdate.blurifchange', true);
variableset.copyrow.target
String
bottom
3.1.13

Valid values: bottombelow

In order to the copied row will be inserted below the selected one, the code should be called: 

Code Block
languagejava
SuncodeFormService.setConfig('variableset.copyrow.target', 'below');

If this option is not set or set to 'bottom', the copied row will be added at the bottom of the table.

variable.variabletoview.genericformat
Boolean
false
3.2.0

By default, for non-editable variables, the function:

Code Block
languagejs
VariableService.getValue('id');
// or
VariableService.getValue('id', false);

Returns total, floating point, amount, date, and "date and time" variables in text format.

That the numeric and dates variables will be returned in the corresponding JavaScript type:

  • total, floating point, amount - number
  • date, and "date and time" - date

Call the code:

Code Block
languagejs
SuncodeFormService.setConfig('variable.variabletoview.genericformat', true);