DataTable Column Resize Callback

PrimeFaces is built around the following principle. “A good UI component should hide complexity and provide flexibility”. When complexity is hidden, it is easy to lose the flexibility since you as page author not in control. Callbacks are a great to provide flexibility, a case in point is column resizing.

Hide the Complexity

Just set resizableColumns attribute to true and voila! your columns are resizable.

Provide Flexibility

There is an optional ajax behavior called colResize that is triggered when a column is resized, this can be used to invoke a method with ColumnResizeEvent, update other components on page and more. Mainly to keep user’s preferences so next time they open the page, their column widths are restored. Note that a cookie is used by default to keep/restore column widths on page refresh but using colResize you can keep the widths wherever you want.

See the Labs Showcase to see this case in action.

2 Responses to DataTable Column Resize Callback

  1. Daniel says:

    cool

  2. great!! Excelent!