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 | ||
|
custom:api_js_publish_event [2019/12/17 12:30] giorgio.scali |
custom:api_js_publish_event [2024/09/05 17:36] (versione attuale) giorgio.scali [Refresh su altra gwClass su modifiche linkListNam] |
||
|---|---|---|---|
| Linea 4: | Linea 4: | ||
| * [[:custom:api_js_publish_event#Elenco function API|Elenco function API]] | * [[:custom:api_js_publish_event#Elenco function API|Elenco function API]] | ||
| * [[:custom:api_js_publish_event#Altri eventi di interesse sottoscrivibili|Altri eventi di interesse sottoscrivibili]] | * [[:custom:api_js_publish_event#Altri eventi di interesse sottoscrivibili|Altri eventi di interesse sottoscrivibili]] | ||
| + | * [[:custom:api_js_publish_event#Trick sottoscrizione eventi|Trick sottoscrizione eventi]] | ||
| Linea 732: | Linea 733: | ||
| </code> | </code> | ||
| + | |||
| + | |||
| + | ===== Trick sottoscrizione eventi ===== | ||
| + | ==== Refresh su altra gwClass su modifiche linkListNam ==== | ||
| + | Quando si vuole il refresh automatico di gwClassList/gwClassDetail su classi diverse da quelle coinvolte nell'associazione/disassociazione effettuata da una linkListNam | ||
| + | La linkListNam di suo coinvolge 3 classi: start, associazione, target. | ||
| + | |||
| + | **dalla 4.7.2** | ||
| + | Usare js api **publishGwClassUpdateWhenLinkListNamChanges()** | ||
| + | |||
| + | I parametri llnamStartClassName, llnamAssociationClassName, llnamTargetClassName sono tutti opzionali e possono essere usati come criteri di restrizione per effettuare il publish | ||
| + | |||
| + | Parameters: | ||
| + | * params, Object, required | ||
| + | * gwClassName, string, required, name of the gwClass to update | ||
| + | * llnamStartClassName, string, optional, name of the linkListNam widget start gwClass | ||
| + | * llnamAssociationClassName, string, optional, name of the linkListNam widget association gwClass | ||
| + | * llnamTargetClassName, string, optional, name of the linkListNam widget end gwClass | ||
| + | |||
| + | |||
| + | <code javascript> | ||
| + | var params = { | ||
| + | gwClassName: 'aaa', | ||
| + | llnamStartClassName: 'bbb', | ||
| + | llnamAssociationClassName: 'ccc', | ||
| + | llnamTargetClassName: 'ddd' | ||
| + | } | ||
| + | var handle = publishGwClassUpdateWhenLinkListNamChanges(params); | ||
| + | //... (later on code) | ||
| + | handle.remove(); | ||
| + | </code> | ||
| + | |||
| + | **pre 4.7.2** | ||
| + | |||
| + | Nel codice sotto le liste e i dettagli della classe gwClassNameTarget, vengono aggiornate su tutte le associazioni fatte da una linkListNam che hanno come target gwClassNameLinkListNamTarget (unico criterio di restrizione) | ||
| + | <code javascript> | ||
| + | //automatically refreshing gwClassNameTarget gwClassList and gwClassDetail | ||
| + | //when any modification is performed on a LinkListNam widget | ||
| + | //var gwClassNameSource = 'gwa_role_r_func'; //not used | ||
| + | var gwClassNameTarget = 'gwa_role_filter_conf'; | ||
| + | var gwClassNameLinkListNamTarget = 'gwa_func'; | ||
| + | require(['dojo/topic'], function(topic){ | ||
| + | topic.subscribe('linkListNam/association/ended', function(data){ | ||
| + | //gwGrid is the LinkListNam widget | ||
| + | //gwGrid.gwClassName is the target gwClass | ||
| + | if(data.gwGrid.gwClassName===gwClassNameLinkListNamTarget){ | ||
| + | var params = null; //it force to reload all related gwClassList and gwClassDetail | ||
| + | publishGwClassUpdate(gwClassNameTarget, params); | ||
| + | } | ||
| + | }); | ||
| + | }); | ||
| + | </code> | ||