Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS /

LeftAndMain - Reload main panel from AJAX call


Reply


2 Posts   350 Views

Avatar
Double-A-Ron

Community Member, 604 Posts

11 March 2014 at 2:56pm

I could do this by directly referencing the DOM, so this is just a check to see if there is a best practise way of reloading a LeftAndMain page on demand. I seem to remember a LeftAndMain::ForceReload method in 2.4 but it doesn't appear to be in 3.1.

Quite simply, I have a button on a form with a click event tied to it in JS. It does not call the form action the button sits in.

$('#Form_UserAssistSession_action_endUserAssistSession').unbind('click').live('click', function(){

   var form = $('#Form_UserAssistSession');

$.ajax({
   url : 'admin/user-assist/endUserAssistSession',
    data : form.formToArray(),
    dataType : "json",
    success : function(json) {
   
       if(json.response == true) {          
          // Refresh main content panel
          
       } else if(json.response == false) {
          // Something happened - display error on screen
       }
       
    },
    error : function(json) {
       console.log(json);
    }
    });

// Return false so no server-side form is processed.
return false;
});

What I want to do is refresh the main panel of LeftAndMain (a form) at the end of this function.

Avatar
Double-A-Ron

Community Member, 604 Posts

17 March 2014 at 3:51pm

success : function(json) {

if(json.response == true) {
// Refresh main content panel
form.removeClass('changed'); // to stop "are you sure" js message
$('.cms-container').entwine('ss').reloadCurrentPanel();
} else if(json.response == false) {
// Something happened - display error on screen
}

},