It turns out that the function described in the previous post is useful for other things besides "filtering as you type". We can use it to "filter" a grid based on the selection of another grid, that is "bind" a grid to another. The process is very similar to what you would do in multiple selects related, and although the function will not work for selects because it uses datagrid's specific methods, it could be easily modified to do so (if you need multiple selects related, check this post ).
The function is the same, so I will not paste it here, what changes are the controls and the first datagrid has some code in its onchange attribute:
onchange="applyFilter(datagrid1.selectedItem.myColumn, datagrid2, ['columnToFilter'])"
In this example we are trying to get all the contacts in the second datagrid that match the “department” column with the id selected in the first datagrid.
<cfgrid name="departmentList" query="departmentsQuery" rowheaders="false" width="120" onchange="applyFilter(departmentList.selectedItem.id, contactList, ['department'])">
<cfgridcolumn name="name" header="Department">
<cfgrid name="contactList" query="contactsQuery" rowheaders="false">
<cfgridcolumn name="name" header="Employee Name">
<cfgridcolumn name="gender" header="Gender">
<cfgridcolumn name="age" header="Age">