Muestra las diferencias entre dos versiones de la página.
Ambos lados, revisión anterior Revisión previa Próxima revisión | Revisión previa | ||
funciones:nfl_updatebyid [02/09/2022 19:01] pedro |
funciones:nfl_updatebyid [14/12/2023 15:48] (actual) pedro |
||
---|---|---|---|
Línea 19: | Línea 19: | ||
* **data-badge-caption**: Para modificar el texto de un wBadget | * **data-badge-caption**: Para modificar el texto de un wBadget | ||
- | ===== Ejemplo de uso ===== | + | ===== Ejemplo de uso por AJAX ===== |
- | {{url>https://samples.nefele.dev/wiki/updatebyid 100%,120px}} | + | {{url>https://samples.nefele.dev/wiki/updatebyid 100%,140px}} |
<Code:xailer linenums:1> | <Code:xailer linenums:1> | ||
PROCEDURE vUpDateById( o ) | PROCEDURE vUpDateById( o ) | ||
- | WITH OBJECT WBevel():New(o) | + | WITH OBJECT WBevel():New( o ) |
- | :aWidth[xc_S] := 6 | + | :lValign := .T. |
- | WITH OBJECT WButton():New(:WO) | + | WITH OBJECT WBevel():New( :WO ) |
- | :cText := "Activar Pulse" | + | :aWidth[ xc_S ] := 5 |
- | :cOnClick := "UpDateById1" // Esto realmente llama a AjaxUpdateById( .T. ) | + | WITH Object WButton():New( :WO ) |
- | :cIcon := "apps" | + | :cText := "Activar Pulse" |
- | :cAjaxBevel := "nflcargo" | + | :cOnClick := "UpDateById1" // Esto realmente llama a AjaxUpdateById( .T. ) |
- | :lLarge := .T. | + | :cIcon := "blur_on" |
- | :lCenter := .T. | + | :cAjaxBevel := "nflcargo" |
- | :nFix := "75%" | + | :lLarge := .T. |
+ | :lCenter := .T. | ||
+ | :nFix := "90%" | ||
+ | :Create() | ||
+ | END WITH | ||
:Create() | :Create() | ||
END WITH | END WITH | ||
- | WITH OBJECT WButton():New(:WO) | + | |
- | :cText := "Desactivar Pulse" | + | WITH OBJECT WBevel():New( :WO ) |
- | :cOnClick := "UpDateById2" // Esto realmente llama a AjaxUpdateById( .F. ) | + | :aWidth[ xc_S ] := 2 |
- | :cIcon := "apps" | + | :lHcenter := .T. |
- | :cAjaxBevel := "nflcargo" | + | WITH OBJECT WIcon():New( :WO ) |
- | :lLarge := .T. | + | :cId := "oicon" |
- | :lCenter := .T. | + | :cIcon := "cancel" |
- | :nFix := "75%" | + | :cSize := "large" |
+ | :Create() | ||
+ | END WITH | ||
:Create() | :Create() | ||
END WITH | END WITH | ||
- | :Create() | ||
- | END WITH | ||
- | WITH OBJECT WBevel():New(o) | + | WITH OBJECT WBevel():New( :WO ) |
- | :aWidth[xc_S] := 6 | + | :aWidth[ xc_S ] := 5 |
- | :lValign := .T. | + | WITH Object WButton():New( :WO ) |
- | WITH OBJECT WIcon():New(:WO) | + | :cText := "Desactivar Pulse" |
- | :cId := "oicon" | + | :cOnClick := "UpDateById2" // Esto realmente llama a AjaxUpdateById( .F. ) |
- | :cIcon := "cancel" | + | :cIcon := "blur_off" |
- | :cSize := "large" | + | :cAjaxBevel := "nflcargo" |
+ | :lLarge := .T. | ||
+ | :lCenter := .T. | ||
+ | :nFix := "90%" | ||
+ | :Create() | ||
+ | END WITH | ||
:Create() | :Create() | ||
END WITH | END WITH | ||
+ | |||
:Create() | :Create() | ||
END WITH | END WITH | ||
Línea 67: | Línea 77: | ||
PROCEDURE AjaxUpdateById( lPulse ) | PROCEDURE AjaxUpdateById( lPulse ) | ||
- | oCGI:SendScript( nfl_UpdateById( { "oicon", lPulse, "pulse" } ) ) | + | oCGI:SendScript( nfl_UpdateById( {{ "oicon", lPulse, "pulse" },; |
+ | { "oicon", "red-text", IIF( lPulse, "addclass", "removeclass") } } ) ) | ||
RETURN | RETURN | ||
Línea 83: | Línea 94: | ||
</Code> | </Code> | ||
+ | |||
+ | ===== Ejemplo de uso directamente con JS ===== | ||
+ | {{url>https://samples.nefele.dev/wiki/updatebyid2 100%,140px}} | ||
+ | <Code:xailer linenums:1> | ||
+ | PROCEDURE vUpDateById2( o ) | ||
+ | |||
+ | WITH OBJECT WBevel():New( o ) | ||
+ | :lValign := .T. | ||
+ | WITH OBJECT WBevel():New( :WO ) | ||
+ | :aWidth[ xc_S ] := 5 | ||
+ | WITH OBJECT WButton():New( :WO ) | ||
+ | :cText := "Activar Pulse" | ||
+ | :cOnClick := "js:" + nfl_UpdateById( { { "oicon", .T., "pulse" },; | ||
+ | { "oicon", "red-text", "addclass" } } ) | ||
+ | :cIcon := "blur_on" | ||
+ | :lLarge := .T. | ||
+ | :lCenter := .T. | ||
+ | :nFix := "90%" | ||
+ | :Create() | ||
+ | END WITH | ||
+ | :Create() | ||
+ | END WITH | ||
+ | |||
+ | WITH OBJECT WBevel():New( :WO ) | ||
+ | :aWidth[ xc_S ] := 2 | ||
+ | :lHcenter := .T. | ||
+ | WITH OBJECT WIcon():New( :WO ) | ||
+ | :cId := "oicon" | ||
+ | :cIcon := "cancel" | ||
+ | :cSize := "large" | ||
+ | :Create() | ||
+ | END WITH | ||
+ | :Create() | ||
+ | END WITH | ||
+ | |||
+ | WITH OBJECT WBevel():New( :WO ) | ||
+ | :aWidth[ xc_S ] := 5 | ||
+ | WITH OBJECT WButton():New( :WO ) | ||
+ | :cText := "Desactivar Pulse" | ||
+ | :cOnClick := "js:" + nfl_UpdateById( { { "oicon", .F., "pulse" },; | ||
+ | { "oicon", "red-text", "removeclass" } } ) | ||
+ | :cIcon := "blur_off" | ||
+ | :lLarge := .T. | ||
+ | :lCenter := .T. | ||
+ | :nFix := "90%" | ||
+ | :Create() | ||
+ | END WITH | ||
+ | :Create() | ||
+ | END WITH | ||
+ | |||
+ | :Create() | ||
+ | END WITH | ||
+ | |||
+ | RETURN | ||
+ | </Code> | ||
===== Parámetros ===== | ===== Parámetros ===== |