C5 Dialog Windows [Dashboard]
Permalink
Hey all,
I've been using C5's javscript calls to $.fn.dialog.open() and instead of using the href parameter (ajax) I feed it the element property, there's a couple problems with this as of late though.
1 The dialog is destroyed (.remove()'d) when it is closed so it cannot be reused.
2. Clone was working on this but my most recent package it started behaving erratically: Dialogs won't close and/or are shown on the page when they should be hidden.
This is my buggy code as of now, I've been playing with using OnDestroy or OnClose to fix it but I can't figure it out. I have some erratic behavior going on in which sometimes the dialog will close via a button with a bound click event that calls a function which finishes by calling $.fn.dialog.closeTop();
I have another project where I clone each dialog and append with a integer. I guess that works ok but I don't like that solution.
Can I get some feedback from others whom have used C5's Dialog Javascript API as to how you've done this successfully. Or maybe the Core team can clue me in to a recommendation?
Thanks...
David
I've been using C5's javscript calls to $.fn.dialog.open() and instead of using the href parameter (ajax) I feed it the element property, there's a couple problems with this as of late though.
1 The dialog is destroyed (.remove()'d) when it is closed so it cannot be reused.
2. Clone was working on this but my most recent package it started behaving erratically: Dialogs won't close and/or are shown on the page when they should be hidden.
This is my buggy code as of now, I've been playing with using OnDestroy or OnClose to fix it but I can't figure it out. I have some erratic behavior going on in which sometimes the dialog will close via a button with a bound click event that calls a function which finishes by calling $.fn.dialog.closeTop();
var dialog = $('#addItemDlg').clone(); $.fn.dialog.open({ title: "Add New Item", element: $('#addItemDlg').clone().attr('id','aditm'), height: 125, width: 250, modal: true, onDestroy: function() { ccm_activateFileSelectors(); $('body').append(dialog); }
I have another project where I clone each dialog and append with a integer. I guess that works ok but I don't like that solution.
Can I get some feedback from others whom have used C5's Dialog Javascript API as to how you've done this successfully. Or maybe the Core team can clue me in to a recommendation?
Thanks...
David
not sure if I can offer much help on the cloning problems. debugging stuff like that is easier when you have running code to test it on. maybe you could experiment with some solution using document.createElement('div') & yourDialogElement.html(), and just injecting the content into the dialog and out of the dialog that way?
Here's how you would access the tools dir within a package's block
Here's how you would access the tools dir within a package's block
<? $uh = Loader::helper('concrete/urls'); $bt=BlockType::getByHandle('document_library' ); $tools_url = $uh->getBlockTypeToolsURL($bt); ?> <a onclick="return false;" href="<?=$tools_url ?>/advanced_search/?cID=<?=$c->getCollectionID()?>&bID=<?=intval($bID) ?>" dialog-title="<?=t('Advanced Search')?>" class="dialog-launch" dialog-width="400" dialog-height="300" dialog-modal="false"><?=t('Advanced Search') ?></a>
Hi,
I had the same problem,
when trying to reload the same pop up twice,
after replacing the div, that was triggering it.
(I was using it in a file selection).
The solution is to unbind the click event,
that triggers the pop up:
I had the same problem,
when trying to reload the same pop up twice,
after replacing the div, that was triggering it.
(I was using it in a file selection).
The solution is to unbind the click event,
that triggers the pop up:
$("#your-pop-up-triggering-div").unbind("click");
Would still appreciate some feedback regarding dialogs though. It doesn't look like you can reference the tools directory of a package therefore having the href (core) style dialogs won't work for a package and we must use the element parameter.....