Technote Details :: A to Z navigation bar uses records from index table and not from recordset
Issue
I filtered the recordset I use in the command and I notice that the A to Z navigation bar has enabled all the entries corresponding to the index table. Some of them should not be displayed as links since the filtered recordset does not include those certain records.
For example, when I create the recordset, I use the contacts table and I filter it to contain only the contacts from the company that has its ID equal to 1:

After applying the A To Z Navigation Bar Wizard and previewing the page in browser, I notice that the A to Z navigation bar displays more enabled entries than the ones corresponding to the filtered records:

There are only three retrieved records and six bar entries displayed as links.
Reason
The extra bar links in the image above cover the rest of the index table records that were not retrieved by the filtered recordset. It happens because when the A to Z navigation bar is instantiated, no condition is added next to the index table name. That is why the bar retrieves as enabled entries all the initials of the index table records.
Solution
In order to fix this anomaly, there is a change in the code source that has to be made:
- Switch to Code view, locate the recordset creation section, and from the SELECT line copy the filtering condition you defined for the recordset (the part that starts with WHERE) -- make sure not to copy the part added by the navigation bar (AND %s).
- Locate the A to Z navigation bar instantiation line, and complete the third parameter (index table name) with the recordset condition:
$navAZ = new NAV_AZ($conn_conn_NavPack, "rsContacts", "contact_con WHERE idcom_con = 1", "name_con", "", KT_getPHP_SELF(), 1, true);
Note: The condition added should use only columns from the index table. See below how to proceed in case joined recordsets are used.
- Then preview again the page in browser and you will see that the bar shows only the right entries as enabled:

Using a joined recordset for the A to Z navigation bar
If you are using a joined recordset, when editing the third parameter in the A to Z navigation bar instantiation line, make sure to list (comma-separated) all the tables involved in the condition added, and then the WHERE condition.
Here is an example: $navAZ = new NAV_AZ($conn_conn_NavPack, "rs", "company_com, contact_con WHERE company_com.id_com = contact_con.idcom_con AND company_com.id_com =1", "name_com", "", KT_getPHP_SELF(), 1, true);.