Button click on rowDblselect

UI Components for JSF
Post Reply
infralumpen
Posts: 10
Joined: 18 May 2015, 23:03

01 Jul 2015, 14:45

Hi! I've a a dataTable and when a row is double clicked I want to apply the button. This is my code:

Code: Select all

<p:dataTable id="datalist" value="#{eqController.getItems(1)}" var="eq"
selectionMode="single" selection="#{eqController.selected}"
rowKey="#{eq.id}">

<p:ajax event="rowDblselect" oncomplete="document.getElementById('acceptButton').click();"/>

.......

<p:button id="acceptButton" value="#{bundle.est_aceptar}" icon="fa fa-home white Fs16 icon-ok" outcome="est_iniciar_2" disabled="#{empty eqController.selected}" />

</p:dataTable>
But I don't get anything..

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

01 Jul 2015, 17:23

There is nothing to call on the server side (no action listener), so the ajax will not fire (afaik). Use PrimeFaces Extensions javascript (pe:javascript) for this.

infralumpen
Posts: 10
Joined: 18 May 2015, 23:03

01 Jul 2015, 22:40

kukeltje wrote:There is nothing to call on the server side (no action listener), so the ajax will not fire (afaik). Use PrimeFaces Extensions javascript (pe:javascript) for this.
AAWESOME!!! thanks a lot!

User avatar
sudheer
PrimeFaces Core Developer
Posts: 4345
Joined: 16 Oct 2011, 19:19
Location: Singapore

02 Jul 2015, 08:17

Also make sure this javascript behavior shoudn't be used for every event and component.Some of the functionalities such as pagination functionality which depends on AJAX behavior.

For example, in the below demo example javascript event will be fired but paging functionality will be broken.

http://www.primefaces.org/showcase-ext/ ... nother.jsf
Last edited by sudheer on 02 Jul 2015, 16:32, edited 1 time in total.
Author,Speaker
https://twitter.com/sudheerjonna
Github: https://github.com/sudheerj
Website http://sudheerjonna.com/

___________________
Sudheer Jonna

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

02 Jul 2015, 10:22

@Sudheer: Care to elaborate? I fail to understand what you try to convey

User avatar
sudheer
PrimeFaces Core Developer
Posts: 4345
Joined: 16 Oct 2011, 19:19
Location: Singapore

03 Jul 2015, 08:40

sorry I just edited the previous post :)
Author,Speaker
https://twitter.com/sudheerjonna
Github: https://github.com/sudheerj
Website http://sudheerjonna.com/

___________________
Sudheer Jonna

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 32 guests