Method Chaining

Method chaining is now supported starting version 5.0. It’s not required, but it provides more readable code and reduce amount of source code in a fluent interface.

For example:

With method chaining (v5.0 and later):

1
2
$dg->set_col_title(“lastName”, “Last Name”)->set_col_required(“lastName”, true)->set_co_default(“lastName”, “Robert”);
$dg->enable_edit(“FORM”)->enable_export(true)->enable_resize(true);

Without method chaining:

1
2
3
4
5
6
$dg -> set_col_title(“lastName”, “Last Name”);
$dg -> set_col_required(“lastName”, true);
$dg -> set_co_default(“lastName”, “Robert”);
$dg -> enable_edit(“FORM”);
$dg -> enable_export(true);
$dg -> enable_resize(true);

No related content found.

Tags: , ,