Announcement Announcement Module
Collapse
No announcement yet.
Partial rendering not working Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Partial rendering not working

    Hi all,

    I'm writing to see if anyone can help me.

    I am working through implementing Spring JS and partial rendering.

    In the example below I have a dialog that simply lists users in a table. If the user clicks edit I wanted an edit form to be displayed (in the same dialog) next to the list of users and thought I could use partial rendering to achieve this.

    So far I have the following tiles defintions:

    Code:
    <definition name="usersDialog.view" template="/pages/usersDialog.jsp">
    		<put-attribute name="users" value="/pages/users.jsp" />
    		<put-attribute name="userEditFormArea" value="/pages/blank.jsp" />
    	</definition>
    	
    	<definition name="usersDialogWithEdit.view" extends="usersDialog.view">
    		<put-attribute name="userEditFormArea" value="/pages/userEditForm.jsp" />
    	</definition>
    When the dialog is initially displayed my Spring controllers return the usersDialog.view.

    If the user clicks Edit another controller returns the usersDialogWithEdit.view.

    I have tried to implement the desired behaviour with the following Javascript.

    Code:
    <script type="text/javascript">
    							Spring.addDecoration(new Spring.AjaxEventDecoration({
    								elementId : "editUserLink",
    								event : "onclick",
    								params: {fragments: "userEditFormArea"}
    							}));
    </script>
    However the edit form never seems to get appended to my view.

    Also to note if I add the popup : true param to the JS (to show the results in a new dialog) I simply see the edit form and not the list as well as the edit form?

    Can anyone highlight what I am missing??

    Many thanks to all who read,

  • #2
    further information

    Hi all,

    After further looking into the issue I'm wondering if I have setup my tiles definitions incorrectly?

    I say this because the users.view is not included in my usersDialogWithEdit.view if I use the popup: true parameter?

    Any help?

    Comment


    • #3
      re:further information

      Hi,
      I am not sure if I understand all,but I have few more question.
      I guess tiles definition is OK. You are worried that when you get usersDialogWithEdit.view in popup you don't get users.jsp. I guess it is correct behaviour as you requested only "userEditFormArea" fragment in your Spring JS decoration.
      So, to clarify if you set popup=true you get the correct content from serwer, yes? So the only problem is that when popup is off, you could not get your fragment rerendered on page?

      So I would suspect something is wrong with just "div" content replacement. Do you have a div with id="userEditFormArea" on both blank.jsp and userEditForm.jsp ???

      Another hint is that I had some problems when I had no characterEncodingFilter configured, maybe you don't have it?

      Comment


      • #4
        Oh right I shall try adding the users to my fragments that might mean the users list will also be rendered.

        Comment


        • #5
          Solved

          Hi

          Found out what my issue was.

          In my usersDialog.view I include a blank.jsp which is quite literally a blank JSP page and it doesn't have the required "userEditFormArea" div which will be replaced upon an Ajax call.

          If I add the required div to the blank.jsp page it successfully gets replaced. So I just need to slightly update my JSP pages.

          Many thanks for the help and the original blog post that helped me get started

          Comment


          • #6
            re: Partial rendering not working

            Hi,
            Nice to see you got it working Good luck

            Comment


            • #7
              I know this is an old post but I am unable to get this partial refresh working either. My question is how high to div's have to cascade. my tiles include flows as such template.jsp->body.jsp->content.jsp->project.jsp->detailsview.jsp->distributionlist.jsp->distribution.jsp

              I have wrapped the table in distribution as div named distribution. my tiles def is as follows:

              Code:
              <definition name="projects/showDetailsTemplate" template="/WEB-INF/views/projects/showDetailsTemplate.jspx">
              	<put-attribute name="milestones" value="/WEB-INF/views/milestones/showList.jspx"/>
              	<put-attribute name="costlineitems" value="/WEB-INF/views/manager/costlineitems/showList.jspx"/>
              	<put-attribute name="distributionList" value="projects/distributionList"/>
              	<put-attribute name="worklogs" value="/WEB-INF/views/worklogs/projectList.jspx"/>
              	<put-attribute name="weeklynotes" value="/WEB-INF/views/weeklynotes/projectList.jspx"/>
              </definition>
              
              <definition name="projects/distributionList" template="/WEB-INF/views/projects/distributionList.jspx">
              	<put-attribute name="distribution" value="/WEB-INF/views/projects/distribution.jspx"/>
              </definition>
              
              <definition name="projects/distribution">
              	<put-attribute name="distribution" value="/WEB-INF/views/projects/distribution.jspx" />

              Comment

              Working...
              X