DataTable: How to catch selection event with JavaScript?
In 3.0 you can use
with callback handler, but p:ajax doesn't generate an optimal code - p:ajax was designed to be used for ajax interactions. I would propose to use pe:javascript from PrimeFaces extensions project http://code.google.com/p/primefaces-extensions/ (momentan you should build it from source, but i will be available in Maven central repo).
Code: Select all
<p:ajax event="rowSelect" .... onclick="handleCustomRowSelect(); return false;" />
Code: Select all
<pe:javascript event="rowSelect" execute="handleCustomRowSelect();" />
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin
Hi Oleg,
thx for your fast reply.
I want to remove the ui-state-highlight class for selected rows.
With this code it works fine.. but i think there is still a better solution. Do you know one?
<p:ajax event="rowSelect" oncomplete="removeHighlight();" />
JS:
function removeHighlight(){
var elm = $("#formId\\:datatableId tr");
elm.removeClass('ui-state-highlight');
}
$(document).ready(function(){
removeHighlight();
});
I don't want to override the datatable.js of primefaces.
thx for your fast reply.
I want to remove the ui-state-highlight class for selected rows.
With this code it works fine.. but i think there is still a better solution. Do you know one?
<p:ajax event="rowSelect" oncomplete="removeHighlight();" />
JS:
function removeHighlight(){
var elm = $("#formId\\:datatableId tr");
elm.removeClass('ui-state-highlight');
}
$(document).ready(function(){
removeHighlight();
});
I don't want to override the datatable.js of primefaces.
Primefaces 4.0
Mojarra 2.1.21
JBoss As 7.0 Final
Internet explorer 9
Mojarra 2.1.21
JBoss As 7.0 Final
Internet explorer 9
Hi,
Why do you remove it via JavaScript in oncomplete? Can you not overwrite .ui-state-highlight for datatable rows in CSS?
Why do you remove it via JavaScript in oncomplete? Can you not overwrite .ui-state-highlight for datatable rows in CSS?
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin
-
- Information
-
Who is online
Users browsing this forum: No registered users and 43 guests