How to use server function data source in selection component
This tutorial shows you how to use Server function as Data source type in selection component. In our example we have form for adding/editing product. Product has Product category attribute, so we will show selection component on this form that is using Server function as Data source type.
1. Login into developer panel.
2. Navigate to Pages menu item.
3. Select page pageProduct.
4. Drag and drop Singleselect component from all components list to formEditProduct.
5. Click on Data source Function field and on the left side of dialog window choose plugin. On the right side choose function. Selected function should return AjaxProxy class which attribute data should be an array with data key (i.e. $result->data[“data”]= array(array(“Id” =>1, “Name” => “Computer and Office”))) or just an array with data key which contains array elements with value and name keys for selection component (i.e. array(“data” => array(“Id” =>1, “Name” => “Computer and Office”))). Click on Save button.
6. Click on Save changes, go into your application and check out the results.