jQuery Mobile Table Widget display issue after ajax update

UI Components for JSF
Post Reply
RElliott
Posts: 94
Joined: 07 Feb 2014, 00:39

12 Sep 2014, 13:29

I use the jQuery Mobile table widget in my PrimeFaces Mobile application because the jQM table widget is more flexible than the PFM PanelGrid. This has been working well and allows me to control the displayed columns and relative sizes of the columns. However, I ran into a problem when I added a jQM table to a PFM accordionPanel where the table did not display correctly after the form was updated as apart of an ajax update. The following is the HTML for the table that I coded in my xhtml page:

Code: Select all

<table
    id="person-contact-telephone"
    class="my-table ui-responsive"
    data-role="table"
    data-mode="columntoggle">
The following is HTML for the table that results on the web page.

Code: Select all

<table 
    id="person-contact-telephone" 
    class="my-table ui-responsive ui-table ui-table-columntoggle" 
    data-role="table" 
    data-mode="columntoggle" 
    style="width: 100%">
Note that jQM or PFM added classes and a style attribute to my table.

At this point my table looks great and I proceed by entering some data into my form and selecting the following button which adds a row to my table.

Code: Select all

<p:commandButton
    value="Add Telephone"
    action="#{personCreater.addTelephone}"
    update="@form" />
On the updated page, my table shows the correct information but does not look good. The updated HTML for the table is as follows:

Code: Select all

<table
    id="person-contact-telephone"
    class="my-table ui-responsive"
    data-role="table"
    data-mode="columntoggle">
As you can see, the updated table is identical to the table that I coded and does not include the extra classes or the style attribute. Why is PFM adding the attributes in the original page and not the ajax updated page?

I resolved the issue by hard coding the classes and style into my table.
PrimeFaces 7.0.1, Glassfish 5.1.0, Oracle JDK 8, Eclipse 2016-02

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

12 Sep 2014, 18:42

i have recognized this behavior, too, so i do p:commandButton/Link ajax=false or h:commandLink almost always, and i'm loving PrimeFaces Mobile because of non-ajax requests (or full page refresh). :)
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

RElliott
Posts: 94
Joined: 07 Feb 2014, 00:39

17 Sep 2014, 01:05

I was able to easily work around this issue for the jQuery Mobile columntoggle table widget by adding the missing classes and the style attribute as described in my original post. Unfortunately, I also encounter this issue with the jQuery Mobile reflow table widget where after the ajax update the pages did not contain the labels for in my reflow table cells.

Before ajax

Code: Select all

<td>
    <b class="ui-table-cell-label">Type</b>
    "HOME"
</td>
After ajax

Code: Select all

<td>
    "HOME"
</td>
Thanks to smithh032772, I resolved this issue by adding "ajax="false"" to my command button.
PrimeFaces 7.0.1, Glassfish 5.1.0, Oracle JDK 8, Eclipse 2016-02

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

17 Sep 2014, 13:08

RElliott wrote:Thanks to smithh032772, I resolved this issue by adding "ajax="false"" to my command button.
good job and you're welcome.
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

18 Sep 2014, 13:14

Using ajax=false is a workaround in my opinion and not a solution... It should work with ajax to

RElliott
Posts: 94
Joined: 07 Feb 2014, 00:39

11 Oct 2014, 15:05

I duplicated these issues in PrimeFaces 5.1. I also created issue 7525 in the community tracker for this issue.
PrimeFaces 7.0.1, Glassfish 5.1.0, Oracle JDK 8, Eclipse 2016-02

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

12 Oct 2014, 05:47

RElliott wrote:I also created issue 7525 in the community tracker for this issue.
thanks
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

13 Oct 2014, 10:19

This is a general problem with ajax and jquery mobile because jqm creates the widgets on load which also needs to happen after ajax updates. Our primefaces mobile widgets do it under the hood, since there is no datatable for now, it is not supported.

Solution is to do it manually after ajax update at onsucces event;

Code: Select all

onsuccess="$(#tableid).table();"
More info at;

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

27 Oct 2014, 11:00

PFM also now has a DataTable;

http://blog.primefaces.org/?p=3326

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 49 guests