phpMv/phpMv-UI

[Bootstrap][HtmlModal] Ajax\bootstrap\html\HtmlModal::setDraggable($value) should be compatible with Ajax\common\html\BaseHtml::setDraggable

dleveugle opened this issue · 4 comments

Steps

$dialog2=$this->jquery->bootstrap()->htmlModal("boite1","Titre de la boîte de dialogue","test");
$form=$this->jquery->semantic()->htmlForm("frm1");
$form->addInput("login","Login");
$form->addButton("","Submit")->asSubmit();
$dialog2->setContent($form->getContent());
echo $dialog2->compile($this->jquery);

Expected Result

No warning

Actual Result

Warning: Declaration of Ajax\bootstrap\html\HtmlModal::setDraggable($value) should be compatible with Ajax\common\html\BaseHtml::setDraggable($attr = 'id', $dropZone = NULL, $parameters = Array) in C:\www\appweb\vendor\phpMv-UI-2.2.6\Ajax\bootstrap\html\HtmlModal.php on line 14

Versions

phpMv 2.2.6
Semantic-ui 2.4.1
jQuery 3.4.1

@dleveugle Thanks for reporting
The Bootstrap HtmlModal setDraggable method needs jQuery-UI, which is not necessarily a good thing.
It is not very relevant to add jQuery-UI in a project just to drag a dialog box...
Does your project already use jQuery-UI?

I'll look at the other method (BaseHtml), to see if it does the job

setDraggable in BaseHtml is assigned to drag n' drop
so I renamed setDraggable to draggable in HtmlModal

Can you try by installing this version:

composer require phpmv/php-mv-ui:dev-master

You have to add jQuery-UI to your project:

<script
  src="https://code.jquery.com/ui/1.12.0/jquery-ui.min.js"
  integrity="sha256-eGE6blurk5sHj+rmkfsGYeKyZx3M4bG+ZlFyA7Kns7E="
  crossorigin="anonymous"></script>

Then you can use:

$dlg=$this->jquery->bootstrap()->htmlModal("dlg","dialog title","dialog content");
$dlg->draggable();

On the other hand, the code you put in the topic mixes Semantic and Bootstrap, which you shouldn't do:

$dialog2=$this->jquery->bootstrap()->htmlModal("boite1","Titre de la boîte de dialogue","test");
       // $form=$this->jquery->semantic()->htmlForm("frm1");
        //$form->addInput("login","Login");
        //$form->addButton("","Submit")->asSubmit();
        //$dialog2->setContent($form->getContent());
        echo $dialog2->compile($this->jquery);

Hi jcheron,

update is ok. No warning anymore.
About Semantic and Bootstrap mix, i understand but i would like to use Datatable from semantic and layout widgets from Bootstrap.
What's the issue with this mix ?
Any recommendations ?

Regards

I think you should find your happiness with Semantic, as far as Layouts are concerned.

The mix is not recommended for 2 reasons:

  • The weight of the loadings (2 Css and 2 Js files)
  • The risks of css or js conflicts

But if you're not in production, it doesn't matter.

Bootstrap DataTables are planned, but not yet developed :-(