Differenze
Queste sono le differenze tra la revisione selezionata e la versione attuale della pagina.
Entrambe le parti precedenti la revisione Revisione precedente Prossima revisione | Revisione precedente | ||
gwusermanual:interface:widget [2025/02/19 15:24] giorgio.scali [LABEL_VALUE_JSON_WIDGET] |
gwusermanual:interface:widget [2025/04/07 10:52] (versione attuale) giorgio.scali [LABEL_VALUE_JSON_WIDGET] |
||
---|---|---|---|
Linea 593: | Linea 593: | ||
^ Parametro ^ Descrizione ^ | ^ Parametro ^ Descrizione ^ | ||
| textHtml| String. Codice html che verrà formattato e visualizzato | | | textHtml| String. Codice html che verrà formattato e visualizzato | | ||
- | | behaviorType | Integer. Se impostato a 0 permette di valutare il valore gli attributi della classe con la notazione ${nome_attributo} | | + | | behaviorType | Integer. Default 1. Possibili valori [1,0]. Di norma vengono sostituite dinamicamente tutte le espressioni del tipo //${field_name}// e del tipo //${session_var_name}// in base al contesto. Per la lista vengono passati i valori dei soli widget aggiunti in lista. Analogamente per il dettaglio di classe. Se behaviorType è impostato a 0 vengono valutati i valori di tutti gli attributi anche quelli non presenti nella lista o nel dettaglio. Questo comporta una query sul dettaglio aggiuntiva, che può causare dei rallentamenti. **Nota: behaviorType a 0 è tassativamente da evitare se il widget va in lista.** Come best practise vanno nel caso messi tutti i field di riferimento in lista, al limite nascondendoli agendo nell'**xml del widget**, cosi: **<listCellStyleRules>display:none;</listCellStyleRules><listCellHeaderStyleRules>display:none;</listCellHeaderStyleRules>**. Sul dettaglio di classe, invece, si può valutare l'utilizzo di behaviorType a 0 nel caso in cui nell'htmlTemplate si richiamino molti attributi attualmente non presenti nel dettaglio, e non si voglia aggiungerli manualmente per poi nasconderli| |
---- | ---- | ||
Linea 992: | Linea 992: | ||
* **order** integer, usato per l'ordinamento (gli elementi senza ordine hanno precedenza, in base all'ordine di comparsa nel JSON) | * **order** integer, usato per l'ordinamento (gli elementi senza ordine hanno precedenza, in base all'ordine di comparsa nel JSON) | ||
* **parameters**, contiene i metadati relativi alle singole coppie chiave valore, organizzate per chiave. **Ogni key è in rapporto 1:1 con le key di primo livello del JSON**, e nel relativo oggetto //value// sono presenti: | * **parameters**, contiene i metadati relativi alle singole coppie chiave valore, organizzate per chiave. **Ogni key è in rapporto 1:1 con le key di primo livello del JSON**, e nel relativo oggetto //value// sono presenti: | ||
- | * **type** string, optional, default "string", valori possibili **string**, **numeric**, **date**, **image**, **html** | + | * **type** string, optional, default "string", valori possibili **string**, **numeric**, **date**, **boolean**, **image**, **html** |
* **label** string, optional, label da usare per la rappresentazione. In sua assenza viene usata la medesima //key// di primo livello del JSON | * **label** string, optional, label da usare per la rappresentazione. In sua assenza viene usata la medesima //key// di primo livello del JSON | ||
* **order**, integer, optional, determina l'ordine all'interno del gruppo (gli elementi senza ordine hanno precedenza, in base all'ordine di comparsa nel JSON) | * **order**, integer, optional, determina l'ordine all'interno del gruppo (gli elementi senza ordine hanno precedenza, in base all'ordine di comparsa nel JSON) | ||
Linea 1006: | Linea 1006: | ||
* **pattern** string, optional, default null. Stesso funzionamento del //widget NumberBox//. Esempi: "#.", "#.00", "#.## %", "#.00 €", "#. €" | * **pattern** string, optional, default null. Stesso funzionamento del //widget NumberBox//. Esempi: "#.", "#.00", "#.## %", "#.00 €", "#. €" | ||
* //type date// (nel //value// del primo livello del JSON ammessi valori nel formato stringa e intero (data in millisecondi)) | * //type date// (nel //value// del primo livello del JSON ammessi valori nel formato stringa e intero (data in millisecondi)) | ||
- | * **format**, string, optional default "dd/MM/yyyy". Formati ammessi: //"dd-MM-yyyy", "yyyy-MM-dd", "yyyy/MM/dd", "dd/MM/yyyy", "dd MMMM yyyy", "yyyy MMMM dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "dd-MM-yyyy HH:mm:ss", "dd-MM-yyyy HH:mm", "dd/MM/yyyy HH:mm:ss", "dd/MM/yyyy HH:mm", "HH:mm:ss": "HH:mm:ss", "EEEE, dd MMMM yyyy"// | + | * **constraints**, object, optional, default null. Con dentro: |
+ | * **datePattern** string, optional, default "dd/MM/yyyy". Formati ammessi: //"dd-MM-yyyy", "yyyy-MM-dd", "yyyy/MM/dd", "dd/MM/yyyy", "dd MMMM yyyy", "yyyy MMMM dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "dd-MM-yyyy HH:mm:ss", "dd-MM-yyyy HH:mm", "dd/MM/yyyy HH:mm:ss", "dd/MM/yyyy HH:mm", "HH:mm:ss": "HH:mm:ss", "EEEE, dd MMMM yyyy"// | ||
+ | * **format** @Deprecated from 4.7.4 (usare constraints.datePattern), string, optional default "dd/MM/yyyy". Formati ammessi: //"dd-MM-yyyy", "yyyy-MM-dd", "yyyy/MM/dd", "dd/MM/yyyy", "dd MMMM yyyy", "yyyy MMMM dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "dd-MM-yyyy HH:mm:ss", "dd-MM-yyyy HH:mm", "dd/MM/yyyy HH:mm:ss", "dd/MM/yyyy HH:mm", "HH:mm:ss": "HH:mm:ss", "EEEE, dd MMMM yyyy"// | ||
* //type image// (nel //value// del primo livello del JSON ammessi solo valori stringa (nome del file, con estenzione, con eventuale path relativo)) | * //type image// (nel //value// del primo livello del JSON ammessi solo valori stringa (nome del file, con estenzione, con eventuale path relativo)) | ||
* **height**, string (HTML height), optional, default "100px". Quando usato imposta un'altezza specifica per l'immagine | * **height**, string (HTML height), optional, default "100px". Quando usato imposta un'altezza specifica per l'immagine | ||
+ | * //type boolean// (nel //value// del primo livello del JSON ammessi valori nel formato boolean true/false) | ||
* //type html// (nel //value// del primo livello del JSON ammessi solo valori stringa, contenenti codice html) | * //type html// (nel //value// del primo livello del JSON ammessi solo valori stringa, contenenti codice html) | ||
Linea 1055: | Linea 1058: | ||
"key_date_2": "2025-02-03T09:16:00.565Z", | "key_date_2": "2025-02-03T09:16:00.565Z", | ||
"key_date_3": 1738573528392, | "key_date_3": 1738573528392, | ||
- | "key_date_4": "2025-02-03 09:16:00", | + | "key_date_4": "2025-02-03T09:16:00.565Z", |
"key_date_5": "2025-02-03T09:16:00.565Z", | "key_date_5": "2025-02-03T09:16:00.565Z", | ||
"key_html_1": "<span style='height: 40px; display: flex; align-items: center;'><i class='fa-solid fa-circle-check gwMainColor icon32x32'></i><span style='margin-left: 15px; font-weight: bold;' >Approved<span/><span/>", | "key_html_1": "<span style='height: 40px; display: flex; align-items: center;'><i class='fa-solid fa-circle-check gwMainColor icon32x32'></i><span style='margin-left: 15px; font-weight: bold;' >Approved<span/><span/>", | ||
Linea 1117: | Linea 1120: | ||
"order": 3, | "order": 3, | ||
"params": { | "params": { | ||
- | "format": "yyyy-MM-dd HH:mm:ss" | + | "constraints": {"datePattern": "yyyy-MM-dd HH:mm:ss"} |
}, | }, | ||
"group_code": "group_3" | "group_code": "group_3" | ||
Linea 1123: | Linea 1126: | ||
"key_date_4": { | "key_date_4": { | ||
"type": "date", | "type": "date", | ||
- | "label": "Data string 'dd-MM-yyyy HH:mm:ss' params.format 'dd-MM-yyyy HH:mm:ss'", | + | "label": "Data string ISO-8601 params.format 'dd-MM-yyyy HH:mm:ss'", |
"order": 4, | "order": 4, | ||
"params": { | "params": { | ||
- | "format": "dd-MM-yyyy HH:mm:ss" | + | "constraints": {"datePattern": "dd-MM-yyyy HH:mm:ss"} |
}, | }, | ||
"group_code": "group_3" | "group_code": "group_3" | ||
Linea 1135: | Linea 1138: | ||
"order": 5, | "order": 5, | ||
"params": { | "params": { | ||
- | "format": "HH:mm:ss" | + | "constraints": {"datePattern": "HH:mm:ss"} |
}, | }, | ||
"group_code": "group_3" | "group_code": "group_3" | ||
Linea 1312: | Linea 1315: | ||
jsonMap.key_date_2 = "2025-02-03T09:16:00.565Z"; | jsonMap.key_date_2 = "2025-02-03T09:16:00.565Z"; | ||
jsonMap.key_date_3 = 1738573528392; | jsonMap.key_date_3 = 1738573528392; | ||
- | jsonMap.key_date_4 = "2025-02-03 09:16:00"; | + | jsonMap.key_date_4 = "2025-02-03T09:16:00.565Z"; |
jsonMap.key_date_5 = "2025-02-03T09:16:00.565Z"; | jsonMap.key_date_5 = "2025-02-03T09:16:00.565Z"; | ||
jsonMap.key_html_1 = "<span style='height: 40px; display: flex; align-items: center;'><i class='fa-solid fa-circle-check gwMainColor icon32x32'></i><span style='margin-left: 15px; font-weight: bold;' >Approved<span/><span/>"; | jsonMap.key_html_1 = "<span style='height: 40px; display: flex; align-items: center;'><i class='fa-solid fa-circle-check gwMainColor icon32x32'></i><span style='margin-left: 15px; font-weight: bold;' >Approved<span/><span/>"; | ||
Linea 1508: | Linea 1511: | ||
key_date_4: [ | key_date_4: [ | ||
type: "date", | type: "date", | ||
- | label: "Data string 'dd-MM-yyyy HH:mm:ss' params.format 'dd-MM-yyyy HH:mm:ss'", | + | label: "Data string ISO-8601 params.format 'dd-MM-yyyy HH:mm:ss'", |
order: 4, | order: 4, | ||
params: [ | params: [ | ||
Linea 1563: | Linea 1566: | ||
</code> | </code> | ||
+ | |||
+ | === Note implementative per le date === | ||
+ | |||
+ | Sebbene il visualizzatore JSON supporto formalmente una grande varietà di formati supportati per il type 'date', nelle implementazioni va usato la versione stringa nel formato **'dd-MM-yyyy HH:mm:ss'** (uguale al //timestamp// del database). Quindi NON la versione ISO-8601, con o senza TIMEZONE. | ||
+ | |||
+ | Questo per le logiche dei filtri del queryBuilder di geoweb. | ||
| |