Hi,
Iam facing a problem..
I got a <q:datatable which gets re-rendered by an ajax call ..i.e on the click of an a4j:commandButton.... but the dataTable gets loaded only when the button is clicked twice... It happens only in some cases..The dataTable immediately gets re rendered on a single click only if initially the datatable is present.. I use the rendered attribute for rendering the datatable.. If initially the datatable is renderd or present in the page,it gets rerendered on single clickof a button..but if its not present initially ..then u need to clcik the button twice to re render the table..
i tried enclsong the datatable in <a4j:outPutPanel> but it wasnt any use....
I hope my problem makes sense..
Please help..
Thanx
Hello,
This issue appears not to be specific to QuipuKit. Ajax4jsf cannot reload a component if it is initially not visible because it doesn't "know" where on the page a component should be loaded. More formally, you cannot change the "rendered" attribute of a component (a DataTable in this case), and rerender this component at the same time. The solution is to retain the functionality that manipulates the "rendered" attribute of your DataTable, but enclose the DataTable inside of <a4j:outputPanel> and rerender that output panel instead of data table. I suppose that the mistake in your case was that you tried to rerender the DataTable instead of output panel.
Please tell if this solves the problem.
Regards,
Dmitry
Hi Dmitry,
Thanx for the reply..It still isnt working..Actually i had enclosed the datatable in a div and was trying to re render the div each time the button is clicked.. but it led to the prblms tat i mentioned above.. I removed the div n enclosed the datatable in the output panel as u mentioned..but that too behaves in the same manner..
The ajax call of the datatable is done based on a value selected from a simple <q:dropdown and then clciking on an a4j:command button so as to render the datatable based on the value selected.. when clicking on the button i found out that the selected value is not submitted to the backend the first time if the datatable is not rendered on the page... but the selected value gets submitted to the back end if the datatable is initially present..something strange.. i guess it maybe the prblm frm my side..
but do let me know ur suggestions
Thanx
This is my code snippet....
<t:htmlTag value="td align='right'">
<a4j:commandButton id="submit" value="Submit" reRender="dat" />
</t:htmlTag>
<a4j:outputPanel id="dat">
<q:dataTable value="somethin" rendered="somethin">
</a4j:outputPanel >
Do let me know if there is to be done any modification in my code which could help it functioning
I am also facing a problem like..if we have a filter attribute in one of the column dropdowns of a datatable..and if we perform a filter on the datable based on any column values selected in the dropdown i.e as shown below
<q:column width="18%" id="Column1" sortingExpression="#{}" sortingComparator="caseInsensitiveText" filterExpression="#{}" filterKind="dropDownField">..
the filtering is done..
but if we try to rerender the table using ajax by pressing on a4j:button..the ajax call is done..but the table doesnt get rerenderd as the column value is still presnt in the filter dropdown..It gets rendered only after making the column filter dropdown blank..
is this anything to do with code from my side..
plz help
Your code snippet outlines the approach that I have mentioned correctly. Did you try replacing the <q:dataTable> by <h:dataTable> or any other component and manipulating its "rendered" attribute in a similar way? Please check whether this problem is specific to <q:dataTable>. Also, please double-check that there are no JavaScript errors or exceptions in the server's logs and let us know the results.
Dmitry
Hello,
First, let me describe how I understand the problem. You have a table with drop-down filtering on one of its columns, and a button, which rerenders this table using Ajax4jsf. First, you filter the table by one of the drop-down values, and then you try to reload tha table by pressing the "rerender" button. If I understand the problem correctly, the table gets reloaded -- it is still displayed as filtered by the selected filter value, but it contains the old row values as they were before the reloading, disregarding any changes that have been made in the underlying data storage. Is my understanding correct?
I have just tried the described scenario and everything worked fine. Please send us an example where we can reproduce the problem.
Dmitry
Hi Dmitry,
Your understanding of my problem is correct...
The situation is in this manner.. I have a datatable which has a set of data.First i filter the table by one of the drop down values.. Then i try to reload the table by pressing the rerrender button..The table has to actually display a different set of data..But since the filter value is still present in the drop down..the datatable output becomes as "No records matching filte criteria" since the filter value doesnt match any of the new data to be loaded... so once we delete the filter value from the drop down and move the focus away from the drop down the new actual datatable gets loaded... But there isnt any problem with the datatable loading,if the filter value matches any of the new data to be loaded.
Hope you got my problem..
Thanks
Hi,
Your situation as you describe it appears to actually reflect the proper behavior of DataTable if I understand you correctly. Refreshing the DataTable with Ajax4jsf is not supposed to remove filtering parameters. So if there are no records that satisfy the filtering criteria then the table will end up showing empty result set after refreshing, just like in your case. Then you remove the filtering value from a filtered column and the fresh data is displayed, which is also correct because there are no more filters to hide any records.
What behavior would you like to have? Would you like that the filtering parameter be removed when refreshing the table? If so, then you can implement this behavior by binding the column's filterValue attribute to a backing bean and clearing that bound value with a server action that should be executed along with Ajax4jsf refresh.
Dmitry