Tutorial: with AJAX
Field reloading This example covers the development of a search application using the reloading of the Ajax field.
Creating a new Grid
1. Create a new grid application using the SQL statement selection as shown below:
2 – In the SQL Select Statement property, enter the sql below:
select
e.employeeid,
e.lastname,
e.firstname,
e.title,
e.titleofcourtesy,
e.birthdate,
e.hiredate,
e.address,
e.postalcode,
e.country,
e.cityid,
e.regionid,
e.homephone,
e.extension,
e.photo,
e.notes,
e.reportsto,
e.photopath,
u.employeeid,
u.territoryid
from
employees e, employeeterritories u, territories t
where
e.employeeid = u.employeeid and
u.territoryid = t.territoryid
You can also create grid using the SQL Builder tool.
3 – In the “Edit fields” menu, select to display the fields as shown in the image below.
Starting the Grid application by Search
4 – Access the “Grid Modules” Menu
5 – Mark the Search as the initial module
Select search fields
6 – Access the menu “Search >> Advanced Filter >> Select Fields”.
7. Choose the E.RegionID and U.TerritoryID fields.
Configuring the fields
8. Open the U.TerritoryID field, in the search fields.
9 – Change the Data Type to Select.
10 – Still in the U.TerritoryID field, access the “Filter Lookup” editing guide and make the settings according to the figure below.
SQL
select territoryid, territorydescription
FROM territories
where regionid = {e.regionId} and
territoryid in (SELECT DISTINCT territoryid from employeeterritories)
order by territoryid
11 – Now access the settings of the E.RegionID field and, in the same way, change the “Data Type” to Select and in the “Filter Lookup”, fill in as follows.
SQL
SELECT regionid, regiondescription
FROM region
WHERE regionid IN (SELECT DISTINCT regionid FROM employees)
ORDER BY regionid
Enabling Ajax to reload the field
12 – Still in the properties of the E.RegionID field, go to the “Ajax Processing” tab and select the U.TerritoryID field by clicking on it and then on the “On / Off” button.
13. Click on “Run application“
Comment this post