voyent
why update complete html inside a ice:form when we use ace:fileEntry  XML
Forum Index -> Contributor's Corner
Author Message
bhuvan

Joined: 19/Aug/2012 23:12:19
Messages: 14
Offline


Let say the xhtml structure is like
Code:
 <ice:form>
     <div id="id_1">
          ...
          <ace:fileEntry>
          ...
     </div>
 </ice:form>
 


If we have some vanila javascript event bind to the div (during initialization of the page ) then after uploading the file it will be lost. As complete html(inside ice:form) is updated.
I know we need to do a full form submit during file upload but i think we dont need to update the html.

I quick way to check that the inside html is getting updated is looking in the respone of the request in firebug.
philip.breau


Joined: 08/May/2006 00:00:00
Messages: 2989
Offline


If the div itself is no longer there after the update it's likely because pure HTML elements are not represented by actual components in the JSF component tree. After the update the component tree is re-rendered, but the div is not there in the component tree, so it isn't rendered. In this you'll have to use an actual component, such as <h:panelGroup layout="block"> or use the icefaces-ee-ext.jar (ICEFaces EE extensions), which can serialize all pure HTML components into actual JSF components in the tree.

Thanks,
Philip

.
bhuvan

Joined: 19/Aug/2012 23:12:19
Messages: 14
Offline


If the div itself is no longer there after the update 

I think i wasnt able to convey the msg.

So let say there is a xhtml
Code:
 ...
 <script type='text/javascript' src='init.js'></script>
 ...
 <ice:form>
     <div id="id_1">
          <ace:fileEntry>
           ...
     </div>
 </ice:form>
 


init.js
Code:
 $(function foo(){
    $("id_1").addClass("I_am_here");
 });
 


now when i will view it in browser the html will be
Code:
 ...
 <form>
     ...
     <div id="id_1" class="I_am_here">
         <input>
          ....
     </div>
 </form>
 


Now if i upload the file the resulting the html of the page is like
Code:
 ...
 <form>
     ...
     <div id="id_1">
         <input>
          ....
     </div>
 </form>
 


The div is also updated.
I think this doesnt happen in iceface1.8

philip.breau


Joined: 08/May/2006 00:00:00
Messages: 2989
Offline


Then it's probably just a matter of the DOM diff climbing up to the nearest parent with an id, which is the div. If an element changes and the DOM diff needs to include that, it will always also include the nearest parent with an id, so that the change can be accurately located in the page, when the update returns. This worked the same way in 1.8, but of course, these are new components, which behave and render differently. Try nesting the fileEntry in a panelGroup, so that the DOM diff might stop there instead of climbing up to the other div. If you still see the too large update after that then compare the before and after DOMs and see what else might have changed.

Philip

.
bhuvan

Joined: 19/Aug/2012 23:12:19
Messages: 14
Offline


Code:
DOM diff climbing up to the nearest parent with an id 


At least it is not happening for me.
I have hierarchy for divs and all have ids.
and all of them are getting updated.

philip.breau


Joined: 08/May/2006 00:00:00
Messages: 2989
Offline


Then you can try to see what other elements are changing by comparing the page HTML before and after. You can also set the following configuration that will log the dom diffs (caution, this may log a large amount of information).

Code:
 <context-param> 
     <param-name>org.icefaces.diffConfig</param-name> 
     <param-value>debugAB</param-value> 
 </context-param>
 

.
bhuvan

Joined: 19/Aug/2012 23:12:19
Messages: 14
Offline



INFO : <ice:form> has one <ace:fineEntry> and only divs inside it

Then you can try to see what other elements are changing by comparing the page HTML before and after  


I did that by below mentioned way and i can see that the complete html inside the form is getting updated.

check for DOM diff:
load the page in browse.
open the firebug net panel.(clean all previous entries)
click upload button.
check the response of the http request in net panel.
philip.breau


Joined: 08/May/2006 00:00:00
Messages: 2989
Offline


Yes, but you have to see exactly which elements have changed. It could be that some element higher up the DOM tree is changing, causing a large DOM update for all child elements.

.
bhuvan

Joined: 19/Aug/2012 23:12:19
Messages: 14
Offline


There is no other ice, ace element
 
Forum Index -> Contributor's Corner
Go to:   
Powered by JForum 2.1.7ice © JForum Team