[Pas2js] bootstrap 5 modal: JQuery(...).modal is not a function

Luca Olivetti luca at ventoso.org
Fri Aug 11 14:51:21 CEST 2023


El 11/8/23 a les 14:19, Michael Van Canneyt via Pas2js ha escrit:

> I'll see about adding static.
> 

What about:


--- a/packages/bootstrap/bootstrapwidgets.pp
+++ b/packages/bootstrap/bootstrapwidgets.pp
@@ -209,6 +209,7 @@ Type
    private
      FHideEl : TJSHTMLElement;
      FBackDrop: Boolean;
+    FStaticBackDrop: Boolean;
      FFocus: Boolean;
      FKeyBoard: Boolean;
      FOnHide: TOnModalHideEvent;
@@ -241,6 +242,7 @@ Type
    Published
      Property ShowOnRender: Boolean Read FShowOnRender Write FShowOnrender;
      Property BackDrop : Boolean Read FBackDrop Write FBackDrop;
+    Property StaticBackDrop : Boolean Read FStaticBackdrop Write 
FStaticBackDrop;
      Property KeyBoard : Boolean Read FKeyBoard Write FKeyBoard;
      Property Focus : Boolean Read FFocus Write FFocus;
      Property Template : String Read FTemplate Write SetTemplate;
@@ -847,12 +849,20 @@ end;
  procedure TBootstrapModal.ApplyWidgetSettings(aElement: TJSHTMLElement);

  begin
-  JQuery(aElement).modal(New([
-    'backdrop', BackDrop,
-    'keyboard', keyboard,
-    'focus',Focus,
-    'show',ShowOnRender
-  ]));
+  if StaticBackDrop then
+    JQuery(aElement).modal(New([
+      'backdrop', 'static',
+      'keyboard', keyboard,
+      'focus',Focus,
+      'show',ShowOnRender
+    ]))
+  else
+    JQuery(aElement).modal(New([
+      'backdrop', BackDrop,
+      'keyboard', keyboard,
+      'focus',Focus,
+      'show',ShowOnRender
+    ]));
    jQuery(aElement).on_('hidden.bs.modal', at BootstrapHide);
  end;



Bye
-- 
Luca


More information about the Pas2js mailing list