title: flash.warning is displayed only after page refresh
body: <p>Hi I have a gsp which will have jq grids and some templates which will be loaded initially.
  if there is some thing wrong in the controller It will be throwing flash.warning like</p>
  
  <pre><code>def err = resp?.status?.message?:resp?.status?.message?:message(code:'common.unknown.error')
  flash.warning = message(code:'common.error.default', args:[err])
  </code></pre>
  
  <p>in the gsp i will be catching it with </p>
  
  <pre><code>&lt;div id="errorPanel"&gt;
          &lt;g:if test="${flash.warning}"&gt;
                  &lt;g:message code = "reporting.label" /&gt;
                  &lt;div class="message"&gt;${flash.warning}&lt;/div&gt;
      &lt;/g:if&gt;
     &lt;/div&gt;   
  </code></pre>
  
  <p>Every thing is fine if te controller is throwing the warning it is displayed only after page refresh.
  Please help me out</p>
  
  <p>my gsp is </p>
  
  <pre><code>&lt;%@ page language="java" import="com.cisco.rms.constants.TicketType" %&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta name="layout" content="main" /&gt;
          &lt;g:set var="entityName" value="${message(code: 'incident.label', default: '&lt;incident.label&gt;')}" /&gt;
          &lt;title&gt;&lt;g:message code = "incident.list" /&gt;&lt;/title&gt;
     &lt;/head&gt;
     &lt;body&gt;
     &lt;div id="errorPanel"&gt;
          &lt;g:if test="${flash.warning}"&gt;
                  &lt;g:message code = "reporting.label" /&gt;
                  &lt;div class="message"&gt;${flash.warning}&lt;/div&gt;
          &lt;/g:if&gt;
     &lt;/div&gt;
     &lt;div class="ros-pageContainer"&gt;
         &lt;div id="incidentListContainer" class="rosPanel"&gt;
             &lt;div id="incidentListHeaderContainer"&gt;
                 &lt;div class="ui-widget-header"&gt;
                     &lt;span class="ros-title"&gt; &lt;g:message code="incident.label.plural" /&gt; &lt;/span&gt;
                     &lt;g:include controller="ticket" action="searchTicketsInclude"/&gt;
                     &lt;!--
                     &lt;span class="header-quick-action"&gt;       
                         &lt;select name="quickactions"&gt;
                                &lt;option selected&gt; &lt;g:message code="common.quickActions.header" /&gt; &lt;/option&gt;
                                &lt;option value="download"&gt;&lt;g:message code="common.quickActions.download" /&gt; &lt;/option&gt;
                                &lt;option value="list and details"&gt;&lt;g:message code="common.quickActions.listAndDetails" /&gt; &lt;/option&gt;
                                &lt;option value="list only"&gt;&lt;g:message code="common.quickActions.listOnly" /&gt; &lt;/option&gt;
                                &lt;option value="list all"&gt;&lt;g:message code="common.quickActions.listAll" /&gt; &lt;/option&gt;
                                &lt;option value="print list"&gt;&lt;g:message code="common.quickActions.printList" /&gt; &lt;/option&gt;
                                &lt;option value="columns"&gt;&lt;g:message code="common.quickActions.columns" /&gt; &lt;/option&gt;
                         &lt;/select&gt;                                    
                     &lt;/span&gt; --&gt;
                 &lt;/div&gt; 
              &lt;/div&gt;
              &lt;jqgrid:wrapper id="incident" /&gt;
          &lt;/div&gt;
          &lt;g:render template="details"/&gt;
  
          &lt;br/&gt;
          &lt;g:render template="/site/sitesAffected"/&gt;
  
          &lt;br/&gt;
          &lt;g:render template="/device/listForIncident"/&gt;  
          &lt;br/&gt;
          &lt;g:render template="/workLog/list"/&gt;    
          &lt;br/&gt;
  
          &lt;g:render template="/alarm/listForIncident"/&gt;
  
      &lt;/div&gt;
      &lt;g:render template="/layouts/gridTemplate" /&gt;
      &lt;script type="text/javascript"&gt; 
  
          function searchByTicketId()
          {
              var ticketId = $('#ticketId').val();
              var id_type = $("input[@name=id_type]:checked").val();;
  
              var ext = false;
              if(id_type == 'external')
                  ext = true;
  
              search(ticketId, ext);
          }
  
          function search(ticketId, ext)
          {   
              var grid = $('#incidentGrid');
  
              grid.jqGrid("clearGridData", true);                 
              grid.jqGrid('setGridParam',{postData:{ticketId:ticketId, extTicketId:ext}});            
              grid.trigger( 'reloadGrid' );
  
              // alert('ticketId: ' + ticketId + ' type: ' + id_type + ' external: ' + ext);
          }
  
          function resetSearch()
          {
              $('#ticketId').val('');
  
              var grid = $('#incidentGrid');
              grid.jqGrid("clearGridData", true)
              grid.jqGrid('setGridParam',{postData:{ticketId:null}});
              grid.trigger( 'reloadGrid' );
  
          }
  
          function onIncidentGridComplete() {
              var devCount = $('#incidentGrid').getGridParam("reccount");
              if (devCount == 1) {
                  var rowId = $('#incidentGrid').getDataIDs()[0];
                  $('#incidentGrid').setSelection(rowId, true);
              }
              $(window).trigger('resize');
          }
  
          var ticketId;
          var ticketType = '${com.cisco.rms.constants.TicketType.INCIDENT}';
  
          function quickActions(actionsList)
          {
              var sel = actionsList.selectedIndex
  
              if(sel == 1)
              {
                  window.open('../workLog/addWorkLog?ticketId=' + ticketId + '&amp;ticketType=' + ticketType, 'Add Worklog', 'width=600,height=600', false)
              }               
          }
  
          function resizeGrid(){
              //$('#incidentGrid').jqGrid('setGridHeight',$(window).outerHeight() - 255 - 25 - $("#incidentDetailsContainer").outerHeight());
          }
  
          function clearDetails() {
              clearIncDetails();
          }
  
          function onSelectRow(rowId) {
              clearDetails();
              $('#quickActions').show();
  
              ticketId = $('#incidentGrid').getCell(rowId, 'id');
              populateDetails(rowId);
  
              var rowMinus1 = parseInt(rowId) - 1;
              $("#incidentGrid tr").removeClass("ui-state-highlight-1");
              $("#incidentGrid tr:eq(" + rowMinus1 + ")").addClass("ui-state-highlight-1");
              resizeGrid();
  
              reloadDeviceGrid(ticketId);
              reloadWorklogs (ticketId, ticketType);
              reloadSitesAffectedGrid(ticketId, ticketType);
              reloadAlarms(ticketId);
          }
  
          function populateDetails(rowId) {
              var grid = $('#incidentGrid');
              var id = grid.getCell(rowId, 'id');
              var submitDate = grid.getCell(rowId, 'submitDate');
              var summary = grid.getCell(rowId, 'summary');
              var status = grid.getCell(rowId, 'status');
              var type = grid.getCell(rowId, 'type');
  
              var data = {id:id, submitDate:submitDate, summary:summary, status:status, type:type};
              populateIncDetails(data);
          }
  
  
  
  
          $(document).ready(function() {
  
              &lt;jqgrid:grid
                  id="incident"
                  url="'${createLink(action: 'listByCompanyJSON', params: [ticketId: params.ticketId])}'"
                  colNames="
                      '${g.message( code:'common.priority' )}',
                      '${g.message( code:'common.id' )}',
                      '${g.message( code:'user.details.site' )}',
                      '${g.message( code:'common.impact' )}',
                      '${g.message( code:'incident.opened' )}',
                      '${g.message( code:'common.parameters.duration' )}',
                      '${g.message( code:'common.status' )}',
                      '${g.message( code:'common.description' )}',
                      '${g.message( code:'common.type' )}'
                  "
                  colModel="
                      {name:'priority', editable: false, fixed: true, width:'55px'},
                      {name:'id', editable: false, fixed: true, width:'100px'},
                      {name:'siteName', editable: false, fixed: true, classes:'ellipsis', width: '200px'},
                      {name:'impact', editable: false, fixed: true, width:'125px'},
                      {name:'submitDate', editable: false, fixed:true, width:'125px'},
                      {name:'duration', editable: false, fixed:true, width:'95px'},
                      {name:'status', editable: false, fixed: true, width:'65px'},
                      {name:'summary', editable: false, classes:'ellipsis' },
                      {name:'type', editable: false, hidden: true}
                  "
  
                  gridComplete="onIncidentGridComplete"
                  onSelectRow="onSelectRow"
                  resizable="true"
                  sortname="'id'"
                  sortorder="'desc'"
                  height="265"
                  autowidth="true"
                  shrinkToFit="true"
                  scrollOffset="16"
                  viewrecords="true"
                  showPager="true"
                  rowNum="12"
                  datatype="'json'"&gt;
                  &lt;jqgrid:navigation  id="incident"   refresh="true" /&gt;
                  &lt;jqgrid:resize id="incident" resizeOffset="0" /&gt;
              &lt;/jqgrid:grid&gt;
  
              //Strips garbage from grid
              $("#incidentListContainer").find("#incidentWrapper").first().removeClass("ui-widget-header");
  
              //Wires window resize so grid will fit properly at all sizes
              $(window).resize(resizeGrid);
  
              $(window).trigger('resize');
  
  
  
          }
  
          );
  
          &lt;/script&gt;
  &lt;/body&gt;   
  &lt;/html&gt;
  </code></pre>