Announcement Announcement Module
Collapse
No announcement yet.
Problem getting view to render in one particular case Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem getting view to render in one particular case

    Hello, I have an issue with getting Spring Webflow and would be grateful for any help. The problem is with displaying a view state when called from a certain page. It works elsewhere.

    I have a flow that exports data to Excel. It is called as a subflow from other flows, and works fine in all but one case. The export subflow first displays a popup where the user can select which columns to export, and upon submit spits out the file. In the case where it doesn't work it does the preliminary preparations, including entering the view state in question but never shows the popup.

    This is the flow, with some added traces:

    "caller" is a string naming the caller so that the correct modelCreator can be selected
    "dataSource" is used by the modelCreator to normalize the raw data into a common form the exporter can use, and in some cases (but not this one) to figure out what columns are available for export.


    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <flow xmlns="http://www.springframework.org/schema/webflow"
          xmlns:ns0="http://www.w3.org/2001/XMLSchema-instance"
          ns0:schemaLocation="http://www.springframework.org/schema/webflow
                              http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"
    
          start-state="selectModelCreator">
    
        <input name="caller" required="true"/>
        <input name="dataSource" required="true"/>
    
    
        <action-state id="selectModelCreator">
            <evaluate expression="modelCreatorSelector.get(caller)" result="flowScope.modelCreator"/>
            <transition to="availableColumns"/>
        </action-state>
    
        <action-state id="availableColumns">
            <evaluate expression="modelCreator.findAvailableHeaders(dataSource)" result="flowScope.kolumner"/>
            <transition to="selectColumns">
                <evaluate expression="modelCreator.trace('transition availableColumns -> selectColumns')"/>
            </transition>
        </action-state>
    
        <view-state id="selectColumns" view="smb/export/excel" model="flowScope.kolumner">
            <on-entry>
                <evaluate expression="modelCreator.trace('entering selectColumns')"/>
                <evaluate expression="modelCreator.trace('kolumner = ' + kolumner)"/> 
            </on-entry>
    		<on-render>
                <evaluate expression="modelCreator.trace('rendering selectColumns')"/> <!-- IT COMES HERE BUT NO FURTHER -->
            </on-render>
            <transition on="submit" to="prepareData">
                <evaluate expression="modelCreator.trace('transition selectColumns -> submit')"/>
            </transition>
            <on-exit>
                <evaluate expression="modelCreator.trace('exiting selectColumns')"/>
            </on-exit>
        </view-state>
    
        <action-state id="prepareData">
            <evaluate expression="modelCreator.prepareModel(dataSource, requestParameters.sortorder, flowScope.kolumner.kolumner)" result="flowScope.exportData"/>
            <transition to="xlsDownload"/>
        </action-state>
    
        <view-state id="xlsDownload" view="excelExportView"/>
    
    
        <bean-import resource="exportExcel-flow-beans.xml"/>
    
    </flow>

    Here is how it is called:

    Code:
    <view-state id="overview" view="#{flowScope.view}">
    		<on-render>
    			<evaluate expression="formAction.setupForm"/>
    		</on-render>
            <transition on="downloadExcel" to="exportFrOverview"/>        
    		...
    	</view-state>
    
        <subflow-state id="exportFrOverview" subflow="exportExcel-flow">
           <input name="caller" value="'overview'"/>
           <input name="dataSource" value="items"/>
        </subflow-state>
    Here is another example that works:

    Code:
    	<view-state id="edit" view="#{flowScope.view}">
    		<on-render>
    			<evaluate expression="formAction.setupForm"/>
    		</on-render>
    		...
            <transition on="downloadExcel" to="exportFrEdit"/>
        </view-state>
    
        <subflow-state id="exportFrEdit" subflow="exportExcel-flow">
           <input name="caller" value="'edit'"/>
           <input name="dataSource" value="details"/>
        </subflow-state>
    The flow is called from a link:
    <a href="javascript:newWindowNoCache('flow?_flowId=va rious-flow&_flowExecutionKey=e5s1&_eventId=downloadExcel ', 'auto' + 150)">

    where noWindowNoCache is an ajax call, displaying the result in a dialog:

    Code:
    function newWindowNoCache(myPage, w)
    {
    	$.ajax({
    		url: myPage,
    		cache: false,
            success:function(result){
    			$("#dialog").html(result);
    			$("#dialog").dialog('option', 'width', w);
    			$("#dialog").dialog('option', 'height', 'auto');
    			$('#dialog').dialog('open');
    		}
        });
    }
    There are no clues in the log (except the ones I temporarily added in the flow as above) and it's set at the lowest logging level. Error handler in the ajax call above give nothing.

    Since it works everywhere else it seems to rule out spelling mistakes or structural errors in the export flow itself. It must also get called correctly since it does the first steps, including selecting the appropriate modelCreator and transferring to the view I want. It just doesn't show it. WHY!? I previously tried using in view-state the popup="true" but didn't get it to work, therefore the current solution. Googling on the problem I have now I found something about rendering fragments for popup to work, but it didn't help anyway.

    Thanks for any suggestions, I'm quite clueless



    Ok, update:
    It executes stuff I put in $(document).ready in the jsp it's supposed to render. If I print the innerHTML it's all there. I can use js/jquery to manipulate it. I tried setting visibility, display and z-index, and log says it changed but it's still nowhere to be seen visually.
    Last edited by zahali; Sep 5th, 2012, 03:15 AM. Reason: did some more testing

  • #2
    Apparently it was a jquery problem rather than anything with the flow. On that particular page the dialog never got initialized. Thanks for having a look anyway.

    Comment


    • #3
      Solved

      Can I mark the thread as solved somehow? Didn't find anything..

      Comment

      Working...
      X