The Joomla! Forum ™



Forum rules


Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 11 posts ] 
Author Message
 Post subject: modal window + update
PostPosted: Thu Oct 29, 2009 3:51 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Nov 13, 2008 11:23 am
Posts: 27
Hi,

I am developing a component and i got stuck on that.

I have a component with a table view, on this table view I have an link on every item to edit it.
I did it using amodal window, I am able to click on edit, the nice modal window opens, I modify the data (the data is well modified) and then i close the window.

But the parent window is not actualised (if i refresh the window, then the data appears actualised),
but it should be a way of doing it actomatically isn't??

Can anyone help me?

What i did to get the modal window is the followind:

1.- put JHTML::_( 'behavior.modal'); on view.html.php
2.- use on the table: <a class="modal" id="popup" rel="{handler: 'iframe', size: {x: 650, y: 700}}" href="?option=com_mycomponent&tmpl=component&id=<?php echo $item->id; ?>"><img src='./images/M_images/edit.png' alt='View details' border=0></a>

thanks in advance,
Albert


Top
 Profile  
 
PostPosted: Thu Oct 29, 2009 7:36 pm 
User avatar
Joomla! Exemplar
Joomla! Exemplar

Joined: Fri Sep 09, 2005 2:13 pm
Posts: 7962
Location: The Netherlands
You need to do it with AJAX then. Otherwise you will not update the parent window. A modal box is AJAX but won't refrsh the parent window.

_________________
Robert Dam - Joomla Forum Moderator
Dutch Boards | Joomla Coding Boards | English Support Boards


Top
 Profile  
 
PostPosted: Thu Oct 29, 2009 9:09 pm 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Wed Apr 15, 2009 5:33 pm
Posts: 725
Location: Fortaleza, CE - Brasil
Trigger this js when you submit your modal window form. This shall reload the whole main page.
Code:
window.parent.location.reload();


I don't tested myself, but it should be easy to adapt the code, if it don't work for what you want.

_________________
.
Nailson Oliveira
Técnico de Tecnologia da Informação - Desenvolvedor Joomla!
-----------------------------------------------------------------------------------------


Top
 Profile  
 
PostPosted: Fri Oct 30, 2009 7:40 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Nov 13, 2008 11:23 am
Posts: 27
Hi I tried to use it on the button
<button class="button validate" type="submit" class="validate" onClick="parent.window.location.reload()">
<?php echo JText::_('Save') ?>
</button>

and on the form by doing onSubmit, and both of them did not work !!

Where else could i place this reload to be effective?
Or what alternative could i apply?

NOTE: I also tried window.parent.location.reload().

Albert


Top
 Profile  
 
PostPosted: Tue Nov 03, 2009 11:38 am 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Wed Apr 15, 2009 5:33 pm
Posts: 725
Location: Fortaleza, CE - Brasil
Try
Code:
window.parent.parent.location.reload();

_________________
.
Nailson Oliveira
Técnico de Tecnologia da Informação - Desenvolvedor Joomla!
-----------------------------------------------------------------------------------------


Top
 Profile  
 
PostPosted: Tue Nov 03, 2009 12:04 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Nov 13, 2008 11:23 am
Posts: 27
no way !!


Top
 Profile  
 
PostPosted: Tue Nov 03, 2009 12:13 pm 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Wed Apr 15, 2009 5:33 pm
Posts: 725
Location: Fortaleza, CE - Brasil
You're right. I just tested here and that doesn't work. However, I also tested window.parent.location.reload(); and it works fine for me, so it should work for you as well...

_________________
.
Nailson Oliveira
Técnico de Tecnologia da Informação - Desenvolvedor Joomla!
-----------------------------------------------------------------------------------------


Top
 Profile  
 
PostPosted: Tue Nov 03, 2009 3:05 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Nov 13, 2008 11:23 am
Posts: 27
It is strange, but it doesn't work for me !!

do you place it at the onClick or onSubmit on the submit button??


Top
 Profile  
 
PostPosted: Tue Nov 03, 2009 3:05 pm 
User avatar
Joomla! Exemplar
Joomla! Exemplar

Joined: Fri Sep 09, 2005 2:13 pm
Posts: 7962
Location: The Netherlands
Make sure you have also javascript tags around it.
Looks like you're writing javascript in PHP, that will not work

_________________
Robert Dam - Joomla Forum Moderator
Dutch Boards | Joomla Coding Boards | English Support Boards


Top
 Profile  
 
PostPosted: Tue Nov 03, 2009 3:16 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Nov 13, 2008 11:23 am
Posts: 27
Could you pass me some code to see how is it implemented ????


Top
 Profile  
 
PostPosted: Tue Nov 03, 2009 4:09 pm 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Wed Apr 15, 2009 5:33 pm
Posts: 725
Location: Fortaleza, CE - Brasil
You can have this set at your main screen:

Code:
<script type="text/javascript" >
function timedReload( time ){ setTimeout( "window.location.reload()", time ); }
</script>


And then, in your modal window you do like this:
Code:
<script type="text/javascript" >
function submitForm(){
var canSubmit = false;
// Validate some fields
if( canSubmit ){
    // Test with different delays, so you can be sure that your
    // form is submitted before tha main page gets reloaded
    window.parent.timedReload( 2000 );
    form.submit();
}
</script>


Note: if you don't manage to call the main window function like this, you can assign it to a hidden button and then fire its onclike event. Hope it helps...

_________________
.
Nailson Oliveira
Técnico de Tecnologia da Informação - Desenvolvedor Joomla!
-----------------------------------------------------------------------------------------


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 11 posts ] 



Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group