Refresh
To avoid having to repaint the whole screen and since some of them can be quite complicated, some tools have been implemented to allow us concrete which properties we want to refresh, so that conditions of visibility, colors, margins, etc., are re-evaluated only for the specified properties.
In case of a FLOATING FRAME, if a frame is refreshed, its direct children are refreshed too, NO its children´s children.
The type=“NC” (Check) prop ALWAYS refresh the whole screen.
The <onchange> node DO NOT refresh the screen when changes the value of some field, if we want to refresh the screen we have to specify the onchange=“refresh(Propiedades_A_Refrescar)” ATTRIBUTE at the property that causes the change.
For what we said earlier, when we have a link field with another collection (MAGNIFYING GLASS), we have to specify the onchange=“refresh(Propiedades_A_Refrescar)” attribute to the link field IDWHATEVER which is the one that changes value and causes the change of the MAP or else use the script ui.refresh “Propiedades_A_Refrescar” method.
<prop name="IDCONCEPTO" type="N" visible="0" mapcol="ClientesConceptos" mapfld="ID" onchange="refresh(MAP_EXPEDIENTE1)"/> <prop name="MAP_EXPEDIENTE1" visible="1" linkedto="IDCONCEPTO" linkedfield="MAP_EXPEDIENTE" type="N">
Attributes in PROP
onchange
In the different prop we have at our disposal the onchange attribute to indicate what we want to refresh when the prop value changes:
<!-- Refresh the full screen when the property value changes --> <prop name="PROP1" ... onchange="refresh"/> <!-- Refresh only the properties specified as parameter (separated by commas) --> <prop name="PROP2" ... onchange="refresh(Calendario,Calendariodatos)"/> <!-- We can made two things, executing a node and then refreshing two properties... --> <prop name="PROP3" ... onchange="executeNode(loquesea),refresh(Calendario,Calendariodatos)" />
NOTICE, onchange=“refresh”, it refresh the FULL collection, included the tabs that are not visible.
postonchange
The postonchange is an attribute executed when we return from an edition with pushvalue or after editing a log of a contents.
<!-- Sólo para Botones y contents. --> <prop name="BOTON1" type="B" ... postonchange="refresh" /> <prop name="@CONTENT1" type="Z" ... postonchange="refresh" />
At the (type=“B”) buttons and in the (type=“Z”) you can also put a postonchange attribute that can have the same values that have been described for the onchange attribute.
This postonchange attribute, defines what we want to do when returning from an editing window launched with a pushvalue or in the case of a contents, when we return from editing a log of this one.
Attributes in NODE
In some node we are going to execute, we can specify that after the execution the full screen will NOT be refreshed (By default, it is refreshed).
refresh
In order NOT refresh the whole screen but only the properties that we want are refreshed, we must specify refresh = “false” as an attribute of the node to be executed, since by default its value is “true”.
refresh-prop
In combination with the refresh=“false” attribute, we have to specify also the refresh-prop attribute to indicate the properties we want to refresh.
<calculaTotal refresh="false" refresh-prop="MAP_PROP1,MAP_PROP2"> ... </calculaTotal>
refresh-owner
If the node executed is in some contents, we can indicate it to refresh a property of the father object with the refresh-owner attribute .
The refresh-owner attribute can be specified in any node of a contents, such as <selecteditem>,<auto-selecteditem>, <ondateselected>, <onpageselected>…
<!-- the refresh-owner it is applied to everything that has a "father collection" --> <!-- <ondateselected> <onpageselected> <auto-selecteditem> <selecteditem> --> <selecteditem refresh-owner="MAP_NOMBRESEL,@MenuControles" show-wait-dialog="false"> ... </selecteditem>
Refresh with SCRIPT
Instead doing it with attributes in the XML, we can indicate it the refresh through an script “refresh” method of AppData.Userinterface, by indicating the properties we want to refresh.
ui.refresh "PROP1,PROP2" //If we do it with VBSCRIPT. ui.refresh("PROP1,PROP2"); //In case doing it in JAVASCRIPT.
RefreshAll
To avoid having to indicate separately all the props that we want to refresh in a view, the RefreshAll method has been implemented, which refreshs all the children(only the first level), of the view or frame passed as parameter.
// With this we tell it to refresh all the children contained in the "floatingRespuesta" Frame. ui.getView(self).refreshAll("floatingRespuesta");
refreshValue. Only the value.
If what changes is only the value of some property and the visual aspect doesn´t vary (font, visibility, foreground and background colors, etc) we can use the “refreshValue” method of AppData.userInterface that is much faster and efficient.
ui.refreshValue "PROP1,PROP2" //If we do it with VBSCRIPT ui.refreshValue("PROP1,PROP2"); //If we do it with JAVASCRIPT
Refresh of a CONTENTS
We can refresh only a log of a contents instead refreshing the full contents. For this, we can use two appData.userInterface methods, which are ui.refreshContentRow and ui.refreshContentSelectedRow
ui.refreshContentRow
In the node we are going to execute, we have to put the refresh=“false” in order NOT to refresh everything, just only what we specify it.
<contentRow refresh="false" > <action name="runscript"> <script language="javascript"> var mContentUsuarios = self.getContents("ContentUsuarios"); mContentUsuarios.loadAll(); <-- Con el getItem(1) cogemos el segundo registro del contents, el primero sería el 0. --> var mObjItem = mContentUsuarios.getItem(1); mObjItem.LOGIN = "paquito"; mObjItem.MAP_COLORVIEW = "#0000FF"; <!-- Los parámetros son el name del prop del contents y el índice en el array de objetos del contents. --> ui.refreshContentRow('@MAP_CONTENT', 1); </script> </action> </contentRow>
ui.refreshContentSelectedRow
In the node we are going to execute, we have to put the refresh=“false” in order NOT to refresh everything, just only what we specify it.
In this case, the selecteditem of the contents is executed, so that the only parameter we have to pass it is the name of the prop of the contents we want to refresh, IT IS NOT necessary to pass it the ID of the array with the position of the log we want to refresh as the case of the previous method, since the selecteditem is executed over the log that the user did select.
<selecteditem refresh="false" show-wait-dialog="false" > <action name="runscript"> <script language="javascript"> <!-- Cambiamos algunos valores del registro --> self.MAP_COLORVIEW = "#00FF00"; //ui.showToast(self.LOGIN); self.LOGIN = "john"; <!-- Le decimos que refresque únicamente la fila actual del contents --> ui.refreshContentSelectedRow('@MAP_CONTENT'); </script> </action> </selecteditem>
Notice that in the refreshing examples of the contents, only the visual appearance on the screen has been updated, at no time the data have been saved.