2 Replies Latest reply: Feb 11, 2011 2:47 AM by nimo stephan RSS

render value is limited to ID

nimo stephan Master

The JSF2 (RF4) supports ajax out of the box with its render-property.

 

The render-property does only accept one or more server-side compontent ID's.

 

Why does the render-value does not support classes?

 

Or going further, why does the render-value does not support css-or jquery-like selectors?

 

It would be very nice and clean to do something like this:

 

<f:ajax render="$('.myclass)" .../>

 

instead of this:

 

<f:ajax render=":form, :text, :table, :menu" .../>

 

myclass could be act as SERVICE:

So I say myclass has the name "update_data_hobbies" and with that name I include all its components which should be considered by invoking the service "update_data_hobbies".

 

<f:ajax render="$('.update_data_hobbies)" .../>

 

<h:form class="update_data_hobbies"..>

..

</h:form>

 

<h:inputText class"update_data_hobbies"../>

 

<rich:datatable class="update_data_hobbies".../>

<!-- and so on.. -->


(by the way, it would be cleaner to extract the service-name from the html5 data-attribute, for example data-ajax=" update_data_hobbies").

 

With the ability to enhance the property with css-jquery-like selectors, I can, for example, easily update all my table-elements:

 

<f:ajax render="$('table')" .../>

 

Go one step further, now the developer can maintain all the ajax-cluttered-code easily by searching for the name of the service, namely update_data_hobbies, within the code  to get or see all related ajax-components in one step without the need to search by ID. Go two steps further, jboss tools can then easily provide an Editor ("ajax-overview-editor") in which all correlated ajax-calls are viewed by its service.

 

One of the main problems while developing ajax-sites is, that it is not very fast and easy to see and maintain all the components which are affected by ajax-calls. It will become harder, if the affected compontens are cluttered in more than one pages, which can happen when using templating future of jsf/facelets. It is annoying, to limit the render-value by its id, it is annoying, to search all the ID's which are listed in the render-value manually. It would leverage the semantic level of developing and maintain jsf-views by introducing the service "update_data_hobbies" instead of its correlated IDs.

 

JSF has the nice future of relating components in data and render via @ (for example @form which relates the form and its enclosed tags where ajax call is made). However, @ is very limited in selecting tags. But maybe, it would be reasonable to  extend the functionality and the meaning of the @-Operator as a @-selector.

 

For this reason, I created a issue:

 

https://issues.jboss.org/browse/RF-10489

 

 


 

 

 

 

 

 

 

 

 

 

Oracle ADF Faces Rich Client Components

  • 1. render value is limited to ID
    Ilya Sorokoumov Master

    1) As far as I know f:ajax is using white space as a separator but not ",". Comma is a separator in RF a4j:ajax. Actually a4j:ajax understands both separators.

    2) I think that this feature you want have in RF is not possible. JQuery selector can't be used in render attribute because server side won't know what elements should be renered. You can always play with css style with JavaScript and JSF won't know about it because it's out of its scope. I guess that as alternative RF team can develop some component to group JSF tree elements on the server side. But it shouldn't have been CSS selector. CSS is only a mechanism to show pretty HTML.

    P.S. I guess you should better raise this topic on RF development forum.

  • 2. Re: render value is limited to ID
    nimo stephan Master

     

    As far as I know f:ajax is using white space as a separator but not ",". Comma is a separator in RF a4j:ajax.

     

     

    Well, you are right, the same goes for styleClass instead of class within jsf-tags.

     

     

    I think that this feature you want have in RF is not possible. JQuery selector can't be used in render attribute because server side won't know what elements should be renered.

     

    I guess, I make it clear in my post, that this feature is actually not possible - hence I made a FEATURE REQUEST. And the example with jquery or css-selector should only give you an EXAMPLE what I mean - so the server-side should integrate jquery-or css LIKE selectors both for data and render-value of ajax-tags - it is absolutely clear that jquery is a client-side script.

     

     

    P.S. I guess you should better raise this topic on RF development forum.

     

    Yes, you are right! That goes in the developement forum. I make a new topic. Thanks !