-
1. Re: RF4: <rich:dataTable> re-render single cell with ajax is not possible
alsha Jul 31, 2013 8:03 AM (in response to alsha)No ideas?
I think, its very important topic. This use case must be very common.
It is a serious regression compared to RF3.3.x...
-
2. Re: RF4: <rich:dataTable> re-render single cell with ajax is not possible
bleathem Aug 1, 2013 4:46 PM (in response to alsha)Have you seen the syntax documented in the RF 4 Component Refernece:
render=tableId:rowId:cellId
or
render=tableId:@rows(bean.rowToUpdate):cellId
-
3. Re: RF4: <rich:dataTable> re-render single cell with ajax is not possible
alsha Aug 2, 2013 3:37 AM (in response to bleathem)Hi Brian,
yes, i've seen this. I thought, this syntax is more suitable for updates, driven from outside the table.
By the way, what is rowId in this notation? Is there an example on how to use it? Is it possible also to update single header/footer cell?
Thanks,
Alexey
-
4. Re: RF4: <rich:dataTable> re-render single cell with ajax is not possible
bleathem Aug 2, 2013 5:19 PM (in response to alsha)rowId would be the numeric indicator of the row. Not really useful in your use case.
How about putting a panelGroup in your cell, and targeting that with your ajax render. See the section "Actions inside the table" in the above linked docs.
-
5. Re: RF4: <rich:dataTable> re-render single cell with ajax is not possible
alsha Aug 5, 2013 9:04 AM (in response to bleathem)I have also tried this way.
First, it is not really easy to force a panelGroup (rendered as div or span) to occupy the whole cell area (if cell has padding or higher as its content).
Second, we have really big dynamic tables, we want to avoid unnecessary components nesting and markup.
-
6. Re: RF4: <rich:dataTable> re-render single cell with ajax is not possible
bleathem Aug 23, 2013 2:42 PM (in response to alsha)How about using the rowKeyVar to get access tothe row number, then you could use the tableId:rowId:cellId syntax.
-
7. Re: RF4: <rich:dataTable> re-render single cell with ajax is not possible
alsha Sep 5, 2013 9:48 AM (in response to bleathem)Hi Brian,
thank you for your suggestion. Is there an example on how to use it?
Is it possible also to update a single header/footer cell using this notation?
Thanks,
Alexey
-
8. Re: RF4: <rich:dataTable> re-render single cell with ajax is not possible
bleathem Sep 5, 2013 4:21 PM (in response to alsha)thank you for your suggestion. Is there an example on how to use it?
I don't have an example on hand, but a quick google search yielded this promising result: http://princesscornflakes.wordpress.com/2008/09/18/use-rowkeyvar-to-access-dynamic-id-from-jsf-datatable-using-javascrip… (Note: I haven't run this sample myself, but it looks good)
Is it possible also to update a single header/footer cell using this notation?
Try the metacomponent ids: tableId@header and tableId@footer.
-
9. Re: RF4: <rich:dataTable> re-render single cell with ajax is not possible
alsha Sep 6, 2013 2:09 PM (in response to bleathem)Ok, I modified my test example like this:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j" xml:lang="en" lang="en"> <h:head></h:head> <h:body> <a4j:log hotkey="M" mode="popup" /> <h:form prependId="false"> <rich:dataTable value="#{testBean.getData()}" var="row" id="table" rowKeyVar="rowId"> <rich:column id="cell" style="background-color:#{empty row[0] ? 'red' : 'green'};"> <h:inputText value="#{row[0]}"> <a4j:ajax event="change" render="table:#{rowId}:cell" /> </h:inputText> </rich:column> </rich:dataTable> </h:form> </h:body> </html>
(Important changes are in bold)
But unfortunately it does not work... What am i doing wrong here?
-
10. Re: RF4: <rich:dataTable> re-render single cell with ajax is not possible
bleathem Sep 6, 2013 2:26 PM (in response to alsha)Can you use your browser's developer tools (eg. firebug) to degub the ajax communication and post both the request and response here? We'll be able to see if the server has responded to the render request in the ajax response.
See:
-
11. Re: RF4: <rich:dataTable> re-render single cell with ajax is not possible
alsha Sep 9, 2013 6:29 AM (in response to bleathem)Ajax Request:
AJAX:EVENTS_COUNT 1
j_id_6 j_id_6
j_id_6_SUBMIT 1
javax.faces.ViewState TTdCtNU/5voqvGfPBAbsBcIuzkubGiRCXaBCkpfEYaty7A3X
javax.faces.behavior.even... change
javax.faces.partial.ajax true
javax.faces.partial.event change
javax.faces.partial.execu... @component table:0:j_id_9
javax.faces.partial.rende... @component
javax.faces.source table:0:j_id_9
org.richfaces.ajax.compon... table:0:j_id_9
rfExt null
table:0:j_id_9 bla
table:1:j_id_9 table:2:j_id_9 table:3:j_id_9 table:4:j_id_9 Response:
<partial-response><changes><update id="javax.faces.ViewState">quQ2UQwlmH4qvGfPBAbsBbc9x/QoZAoR8AY/0Q+qXii2QV89</update><extension id="org.richfaces.extension"><render>table:0:cell</render></extension>
</changes>
</partial-response>
-
12. Re: RF4: <rich:dataTable> re-render single cell with ajax is not possible
bleathem Sep 9, 2013 2:15 PM (in response to alsha)you can see from the request headers that the input is correctly getting executed, but the value you specified for the render target is not getting evaluated, likely because the row itself is not a valid JSF component. This is where the meta component resolver (tableId@rows) syntax is meant to apply.
So try it with the meta component resolver syntax, and if that doesn't work I'll ask you to file a bug report.
-
13. Re: RF4: <rich:dataTable> re-render single cell with ajax is not possible
alsha Sep 11, 2013 8:20 AM (in response to bleathem)It does not work as well:
<a4j:ajax event="change" render="table:@rows(testBean2.rowsToUpdate):cell" />
It works only, if I re-render some component inside of <rich:column>, like this:
<rich:column id="cell"> <h:inputText value="#{row[0]}" id="input" style="background-color:#{empty row[0] ? 'red' : 'green'}"> <a4j:ajax event="change" render="table:@rows(testBean2.rowsToUpdate):input" /> </h:inputText> </rich:column>
Simpler notation also works in this case:
<a4j:ajax event="change" render="input" />
But not the following:
<a4j:ajax event="change" render="cell" />
-
14. Re: RF4: <rich:dataTable> re-render single cell with ajax is not possible
bleathem Sep 11, 2013 3:12 PM (in response to alsha)Thanks for trying this out. Can you file an issue?