Data tables: server side rendering or client side widgets?

No matter how great a framework AngularFaces may be, it has to fit into existing
infrastructures. Of course, the best way to get familiar with AngularFaces is the green field scenario.
Start with a fresh and empty project, and you'll be able to get the most out of your new tool.

However, I think many developers already have a lot of code, and they just want to add
AngularFaces to their tool box. That why I started to write AngularFaces in the first place: I wanted
to solve a problem that was simple on the client and very difficult on the client side. I didn't want
to rewrite the entire application, I just wanted to add a few features to an existing application.

Embedding a PrimeFaces datatable in an AngularFaces application

One of the finest pieces of art in the JSF world is the PrimeFaces datatable. The good news is it is
compatible to AngularFaces. PrimeFaces uses optimized requests to update the table when it is sorted,
when you enter a filter criterium or when you browse to another page of the paginator.

Note that editable data tables or tables with buttons are a bit tricky in AngularFaces 2.1. Due to the limitations of AngularJS,
the way JSF generates HTML ids isn't compatible to AngularJS. In most cases, this isn't a big deal. First, you can
solve the problem by adding prependId="false" to your h:form. Second, most of AngularFaces 2.1.3
works with the standard ids of JSF. But data tables don't work with prependId="false". So you can give
it a try - but chances are you run into problems with AngularJS.

ngTable and SmartTable - client side alternatives

The other bad news it the PrimeFaces DataTable doesn't benefit much from AngularFaces
(apart from the automatic translation to foreign languages, of course).

On the long run it's better to use an AngularJS table. There are many table widgets. A particularly powerful
table widget is ngTable by Vitalii Savchuk. Another interesting
client-side table widget is SmartTable. It's used by the Tetris demo.

The nice thing about AngularJS is it allows for client side widgets that are every bit as simple as server side widgets.
Using ngTable, table including paginators, filters, sort buttons and even a CSV (aka Excel) export looks like so:

The advantage of using ngTable is it's entirely rendered and controlled by AngularJS. Every feature of AngularJS is available to you. For instance,
the values of the cells are taken from the AngularJS scope. You can set watches on them, use directives to
add validation constraints and much more.

Truth to tell, ngTable requires some support of the controller to do its magic. Future versions of AngularFaces will
address this problem and reduce the amount of boiler plate code required to do common tasks.

Buttons in a client-side table

The advantage of using a client-side widget turn into a disadvantage when you add a JSF command button to the table rows. AngularJS knows nothing about the server.
The car dealer demo shows a way out. Define a selected attribute in the AngularJS model and synchronize it with the server.
The selected attribute is filled with an id that's stored on ngclick:

You can also use the global AngularFaces function afToJson(car) to serialize the object displayed by the row.

Data tables: server side rendering or client side widgets?

No matter how great a framework AngularFaces may be, it has to fit into existing
infrastructures. Of course, the best way to get familiar with AngularFaces is the green field scenario.
Start with a fresh and empty project, and you'll be able to get the most out of your new tool.

However, I think many developers already have a lot of code, and they just want to add
AngularFaces to their tool box. That why I started to write AngularFaces in the first place: I wanted
to solve a problem that was simple on the client and very difficult on the client side. I didn't want
to rewrite the entire application, I just wanted to add a few features to an existing application.

Embedding a PrimeFaces datatable in an AngularFaces application

One of the finest pieces of art in the JSF world is the PrimeFaces datatable. The good news is it is
compatible to AngularFaces. PrimeFaces uses optimized requests to update the table when it is sorted,
when you enter a filter criterium or when you browse to another page of the paginator.

Note that editable data tables or tables with buttons are a bit tricky in AngularFaces 2.1. Due to the limitations of AngularJS,
the way JSF generates HTML ids isn't compatible to AngularJS. In most cases, this isn't a big deal. First, you can
solve the problem by adding prependId="false" to your h:form. Second, most of AngularFaces 2.1.3
works with the standard ids of JSF. But data tables don't work with prependId="false". So you can give
it a try - but chances are you run into problems with AngularJS.

ngTable and SmartTable - client side alternatives

The other bad news it the PrimeFaces DataTable doesn't benefit much from AngularFaces
(apart from the automatic translation to foreign languages, of course).

On the long run it's better to use an AngularJS table. There are many table widgets. A particularly powerful
table widget is ngTable by Vitalii Savchuk. Another interesting
client-side table widget is SmartTable. It's used by the Tetris demo.

The nice thing about AngularJS is it allows for client side widgets that are every bit as simple as server side widgets.
Using ngTable, table including paginators, filters, sort buttons and even a CSV (aka Excel) export looks like so:

The advantage of using ngTable is it's entirely rendered and controlled by AngularJS. Every feature of AngularJS is available to you. For instance,
the values of the cells are taken from the AngularJS scope. You can set watches on them, use directives to
add validation constraints and much more.

Truth to tell, ngTable requires some support of the controller to do its magic. Future versions of AngularFaces will
address this problem and reduce the amount of boiler plate code required to do common tasks.

Buttons in a client-side table

The advantage of using a client-side widget turn into a disadvantage when you add a JSF command button to the table rows. AngularJS knows nothing about the server.
The car dealer demo shows a way out. Define a selected attribute in the AngularJS model and synchronize it with the server.
The selected attribute is filled with an id that's stored on ngclick:

You can also use the global AngularFaces function afToJson(car) to serialize the object displayed by the row.

Data tables: server side rendering or client side widgets?

No matter how great a framework AngularFaces may be, it has to fit into existing
infrastructures. Of course, the best way to get familiar with AngularFaces is the green field scenario.
Start with a fresh and empty project, and you'll be able to get the most out of your new tool.

However, I think many developers already have a lot of code, and they just want to add
AngularFaces to their tool box. That why I started to write AngularFaces in the first place: I wanted
to solve a problem that was simple on the client and very difficult on the client side. I didn't want
to rewrite the entire application, I just wanted to add a few features to an existing application.

Embedding a PrimeFaces datatable in an AngularFaces application

One of the finest pieces of art in the JSF world is the PrimeFaces datatable. The good news is it is
compatible to AngularFaces. PrimeFaces uses optimized requests to update the table when it is sorted,
when you enter a filter criterium or when you browse to another page of the paginator.

Note that editable data tables or tables with buttons are a bit tricky in AngularFaces 2.1. Due to the limitations of AngularJS,
the way JSF generates HTML ids isn't compatible to AngularJS. In most cases, this isn't a big deal. First, you can
solve the problem by adding prependId="false" to your h:form. Second, most of AngularFaces 2.1.3
works with the standard ids of JSF. But data tables don't work with prependId="false". So you can give
it a try - but chances are you run into problems with AngularJS.

ngTable and SmartTable - client side alternatives

The other bad news it the PrimeFaces DataTable doesn't benefit much from AngularFaces
(apart from the automatic translation to foreign languages, of course).

On the long run it's better to use an AngularJS table. There are many table widgets. A particularly powerful
table widget is ngTable by Vitalii Savchuk. Another interesting
client-side table widget is SmartTable. It's used by the Tetris demo.

The nice thing about AngularJS is it allows for client side widgets that are every bit as simple as server side widgets.
Using ngTable, table including paginators, filters, sort buttons and even a CSV (aka Excel) export looks like so:

The advantage of using ngTable is it's entirely rendered and controlled by AngularJS. Every feature of AngularJS is available to you. For instance,
the values of the cells are taken from the AngularJS scope. You can set watches on them, use directives to
add validation constraints and much more.

Truth to tell, ngTable requires some support of the controller to do its magic. Future versions of AngularFaces will
address this problem and reduce the amount of boiler plate code required to do common tasks.

Buttons in a client-side table

The advantage of using a client-side widget turn into a disadvantage when you add a JSF command button to the table rows. AngularJS knows nothing about the server.
The car dealer demo shows a way out. Define a selected attribute in the AngularJS model and synchronize it with the server.
The selected attribute is filled with an id that's stored on ngclick:

You can also use the global AngularFaces function afToJson(car) to serialize the object displayed by the row.

Data tables: server side rendering or client side widgets?

No matter how great a framework AngularFaces may be, it has to fit into existing
infrastructures. Of course, the best way to get familiar with AngularFaces is the green field scenario.
Start with a fresh and empty project, and you'll be able to get the most out of your new tool.

However, I think many developers already have a lot of code, and they just want to add
AngularFaces to their tool box. That why I started to write AngularFaces in the first place: I wanted
to solve a problem that was simple on the client and very difficult on the client side. I didn't want
to rewrite the entire application, I just wanted to add a few features to an existing application.

Embedding a PrimeFaces datatable in an AngularFaces application

One of the finest pieces of art in the JSF world is the PrimeFaces datatable. The good news is it is
compatible to AngularFaces. PrimeFaces uses optimized requests to update the table when it is sorted,
when you enter a filter criterium or when you browse to another page of the paginator.

Note that editable data tables or tables with buttons are a bit tricky in AngularFaces 2.1. Due to the limitations of AngularJS,
the way JSF generates HTML ids isn't compatible to AngularJS. In most cases, this isn't a big deal. First, you can
solve the problem by adding prependId="false" to your h:form. Second, most of AngularFaces 2.1.3
works with the standard ids of JSF. But data tables don't work with prependId="false". So you can give
it a try - but chances are you run into problems with AngularJS.

ngTable and SmartTable - client side alternatives

The other bad news it the PrimeFaces DataTable doesn't benefit much from AngularFaces
(apart from the automatic translation to foreign languages, of course).

On the long run it's better to use an AngularJS table. There are many table widgets. A particularly powerful
table widget is ngTable by Vitalii Savchuk. Another interesting
client-side table widget is SmartTable. It's used by the Tetris demo.

The nice thing about AngularJS is it allows for client side widgets that are every bit as simple as server side widgets.
Using ngTable, table including paginators, filters, sort buttons and even a CSV (aka Excel) export looks like so:

The advantage of using ngTable is it's entirely rendered and controlled by AngularJS. Every feature of AngularJS is available to you. For instance,
the values of the cells are taken from the AngularJS scope. You can set watches on them, use directives to
add validation constraints and much more.

Truth to tell, ngTable requires some support of the controller to do its magic. Future versions of AngularFaces will
address this problem and reduce the amount of boiler plate code required to do common tasks.

Buttons in a client-side table

The advantage of using a client-side widget turn into a disadvantage when you add a JSF command button to the table rows. AngularJS knows nothing about the server.
The car dealer demo shows a way out. Define a selected attribute in the AngularJS model and synchronize it with the server.
The selected attribute is filled with an id that's stored on ngclick:

You can also use the global AngularFaces function afToJson(car) to serialize the object displayed by the row.