DataTable Hooks

Most notable thing about PrimeFaces 3.0.M2 is the implementation of component callbacks as ajax behaviors, read more here about the idea here.  

While providing the component events as behaviors, I have decided to add more hooks to increase flexibility even more. Frameworks like JSF and the component libraries tend to do a lot for you but important design principle of PrimeFaces is transparency and keep page author in control. As an application developer, I don’t like the feeling that I’m not the one in control when using frameworks.

One example is datatable, we have built-in paging, sorting, filtering but what if you want to execute custom javascript before and after paging, what if you want to update other components on page or execute a custom java method during pagination? Here is how it can be done;

<p:datatable paginator="true" rows="10" value="#{bean.items}" var="item">
   <p:ajax event="page" listener="#{bean.onPaginate}" update="othercomponents" oncomplete="alert('done')"... />

Note that you don’t have to define page ajax behavior just to do regular pagination, it is only needed if you need to hook-in, otherwise default pagination will take place.

The new ajax behaviors bring great flexibility to PrimeFaces, in our forum I see that many of the limitations people are facing can easily be solved using our new approach.

Next generation of PrimeFaces is faster, smaller, more secure and much more flexible.


5 Responses to DataTable Hooks

  1. It’s great feature!

  2. Marcos says:

    very nice, good job

  3. bitec says:

    Marvellous! Very flexible way

  4. Jonathan Ekwempu says:

    I am happy with the functionality being built into DataTable. In one of my posts to you, I mentioned the need for resizable columns. Thanks for adding resizable columns which was one of the major functionalities lacking in your table implementation. Thank’s too to the company that sponsored it (please let us know the company). It is good to know companies that sponsor open source development. It would be nice to see resizable columns work with other attributes (sorting, filtering etc) of the the DataTable seamlessly.

    One other functionality lacking (in my opinion a very important one at that) is the ability to jump to any page of the datatable. This functionality is very important when paging a large dataset. If it is a functionality already in place, please point me in the right direction.

    I hope too that by the time M2 is realeased you will have a detailed documentation covering the components as of that release. I don’t mind even if it is a paid documentation. In as much as I love theme styling, most coporate entities have their unique colors and may be using more that one component (framework) in their applications. A good documentation that shows the possible attributes of the components and how to apply custom styles to them would be ideal.

    Thanks for the good work you are doing and I am pleased to say that primefaces has evolved to be one of the best JSF components if not the best.

  5. Julian says:

    Great Job!

%d bloggers like this: