Use of a4j:jsFunction Within a Paginated OpenFaces 3 Datatable - datatable

I've a paginated OpenFaces 3 datatable (using o:dataTablePaginator within a facet below the table) that has a column which contains an a4j:jsFunction tag (using RichFaces 4.1) to create (a differently named) JavaScript function within each row of the table. The JSF 2.1 page which contains the table is being deployed within an application onto Glassfish 3.1.
When I click the next page icon for the table, the datatable fails to update via AJAX with the OpenFaces AJAX "Loading..." message (with the "spinning" diamond) remaining displayed in the top right corner of the page. In Firebug, I can see the result of the OpenFaces AJAX Post being an error with the affected line 344 of ajaxUtil.js:
TypeError: xml.getElementsByTagName("partial-response")[0] is undefined
var childNodes = xml.getElementsByTagName("partial-response")[0].childNodes;
and the following error in IE Developer Tools:
SCRIPT5007: Unable to get value of the property 'childNodes'
: object is null or undefined
I've been able to eliminate all other tags within the datatable being the cause of the problem except for this one:
<a4j:jsFunction id="cellUpdateFunction#{rowIndex}"
name="updateCellStr#{rowIndex}"
data="#{backingBean.getStrForRow(rowIndex)}" execute="#this"
oncomplete="setCellText(#{rowIndex}, event.data);"/>
This creates a JavaScript function in a column cell (for each row of the table) that when called updates the text in the cell with the string stored for the cell within the backing bean.
Does anyone know whether this is a known issue and there is a workaround I've been unable to find? Otherwise, how would I go about writing similar functionality with OpenFaces AJAX as I expect that using only OpenFaces components would not break the AJAX call updating the OpenFaces datatable?
Thanks in advance for any help.

Can you try to use the nightly builds and check? You can find nightly builds here: http://openfaces.org/downloads/

Related

How to load datatable on change of dropdown

I have a view where there is a dropdown and datatable.
At initial load, I am loading the values to be loaded in the datatable based on the first select of dropdown and on change of dropdown, I want to fetch data based on that condition and populate those data on the datatable.
Please anyone suggest a way to do this!
I am trying a way using get request but it is reloading the page and hence I am unable to make the data persist in the datatable.
I followed exactly this https://laracasts.com/discuss/channels/laravel/filtering-data-using-drop-down-onchange-event
Data is coming and populates to the datatable but just after a second, it reloads and comes to old data in datatable.
Please either correct my or suggest some new way to do it!
After debugging, I found that in one of the js file included, there were a code
$(document).ajaxStop(function() {
window.location.reload();
});
Since, this code was making it to reload on every ajax call completes, I faced this issue.

How to add data in popup using primefaces and ajax call

I am new in JSF, facing a problem while executing GET AJAX request.
I have a icon with a counter (number), once I will do mouse over to the icon it shows a kind of small popup with small list (3 items), kind of same behavior as we have in Social networking sites (Notification icon). Till here All good. Now in my pop up at bottom side, I added a text says "Show more". This should get 3 more items/ notification from the DB via Ajax call and add the response in the popup (without closing the popup), then in total there should be 6 items.
I am not sure how exactly I can achieve this, Please help.
Using <h:outputText value="show more}"> in my xhtml.
In my bean I have a method to getMoreNotification().
Recently I tried with <p:remoteCommand>, but not sure how I can add responce/ data in popup.
Thanks in advance.
Not that difficult
Create a list which is initially populated with 3 items
Create a <p:overlay> with IN that <p:overlay> e.g. a <p:dataList> that shows these list mentioned in 1. Give this component an id, e.g. 'notifications'
When clicking on the 'show more' commandLink, execute the getMoreNotification() via an actionListener and IN that method update the list mentioned in 1. Also make sure you have an update attribute that contains the value of the <p:dataList>.

dataTable only refreshed After Site refresh

I use primefaces and the dataTable component. On my Site i have several forms which i use to collect Data and persist it in the Database. This is triggered by a p:command Button, which Attribute “Update“ contains the id of the dataTable showing the DB contents. When i submit the Form the component (table) is Not updated. What could be wrong?
not an answer but a question to help divine the point of failure. is the datatable in a separate form from the commandButton? if so, assuming you're using ajax="true" (the default for pf components), how are you referencing the table to make sure it updates. if you're not using ajax, i'm guessing it's a stale data issue in the backing bean. but without more info, it's hard. try attaching source code (stripped down to your comfort level if you're working on something sensitive).
HTH

Zend_Form_Element_Select onchange

I am unable to set value of text, radio and other form elements based on a select element onchange.
All form elements are part of the same form.
The values to be set are to be fetched from database table without refreshing/redirecting the whole page (may be using Ajax).
Solution should be MVC based. I am a ZF novice.
Made it work with the help of following link:
http://zendgeek.blogspot.in/2009/07/ajax-with-json-and-prototype-in-zend.html
I used JQuery $.ajax() in place of prototype.js Ajax.Request() as the latter was conflicting somewhere with a datepicker element and I thought why to include one more js file when already JQuery is there.

making primeFaces ajax call in dataTable

I am using JSF 2 with PrimeFaces 2.2. I tried making an ajax call through a select box onchange event in a dataTable. I was able to see the System.outs printing but, I could not see the components given in the update attribute getting updated. I have given the dataTableId in the update attribute.
I guess the problem now is the selectbox is getting populated again and an ajax call is made. Should we give only the parent tags in the update attirbute, for the ajax call to work. Please help me out in this.
When the ID in the update attribute does not start with :, it becomes relative to the ID of the current component inside the same NamingContainer component. But since the h:dataTable is an NamingContainer component, you need to reference it by an absolute ID. Rightclick the JSF page in the webbrowser and choose View Source to see the generated HTML DOM tree. Locate the HTML <table> element which is generated by the <h:dataTable>, determine the value of its id attribute and use exactly that id in the update attribute, prefixed with :.

Resources