Hi all,We have a list page with a typeahead field on the extended filter. When we choose an item on the typeahead combo, the search button doesn’t work and the loading icon is showing. We inspect the page and find that there is an javascript error and the search button doesn’t work:Uncaught TypeError: Cannot read property ‘af0’ of undefined
at Object.d [as success] (ew.min.js:1)
at c (jquery-3.5.1.min.js:2)
at Object.fireWith [as resolveWith] (jquery-3.5.1.min.js:2)
at l (jquery-3.5.1.min.js:2)
at XMLHttpRequest. (jquery-3.5.1.min.js:2)It happens when a typeahead combo has a very long list.
Any ideas?
You may check the HTTP response of the lookup action, see https://discourse.hkvstore.com/t/check-http-response/3213/1 wrote:
It happens when a typeahead combo has a very long list.
Are you sure it is a typeahead (i.e. AutoSuggest)? AutoSuggest usually show 10 items only (not a long list).
Please post the related settings in Fields setup of your PHPMaker project for more discussion.
The field is called ItemID. It links to an item table with a lot of records. On the edit tag, we selected “Text” with “use lookup table”. Checked “force selection”. On the lookup table tag, we chose the item table. Link field: ItemID. Display field #1: Name. Allow sort/search: checked. Auto fill: there are 3 fields selected (we tried to remove them, but still the same). On the advance settings, the auto-suggest max display entries: 80 (we tried to change it to 10, but still the same)
The feature should be working as I tried in the demo project from orders table → EmployeeID field, by changing it from Select control to Text control from Edit Tag pane, and I enabled Force selection, also enabled Allow sort/search, then the typeahead feature works.
- Re-synchronize your latest database structure with your PHPMaker project from Tools → Synchronize,
- Re-generate ALL the script files, and please try again.
We tried to change another filter item ProjectID to text control on the same page. Its lookup table has 51 records. We can search with ProjectID filter. But ItemID with the same field settings doesn’t work. Its lookup table has 13,107 records.
skymark wrote:
Display field #1: Name.
- Make sure you have already selected ItemID from Display field #2,
- Make sure you have already enabled Auto-Suggest for all display fields from Tools → Advanced Settings,
- Make sure you have already re-generated ALL the script files,
- Then try again.
We had enabled Auto-Suggest for all display fields before. We tried to select ItemID from Display field #2. But it had the same issue.
Cannot reproduce the issue.As I mentioned from the code in my previous reply above, the feature is working properly as I tested it in the demo project. Please try it in the demo project first, does it work?
We have found out the cause of this issue. This table includes two fields: ItemID, ItemCode. ItemCode has a parent/filter that is set to ItemID/ItemID. When we change the filter on ItemID, the search button is disabled, the loading icon is showing and there is an javascript error:
Uncaught TypeError: Cannot read property ‘af0’ of undefined
at Object.d [as success] (ew.min.js:1)
at c (jquery-3.5.1.min.js:2)
at Object.fireWith [as resolveWith] (jquery-3.5.1.min.js:2)
at l (jquery-3.5.1.min.js:2)
at XMLHttpRequest. (jquery-3.5.1.min.js:2)If we uncheck ItemCode for ext. search, it’s ok, search works and there is no error.Please let us know how to fix it. Thanks.
skymark wrote:
Please let us know how to fix it. Thanks.
Didn’t you mention it before?skymark wrote:
If we uncheck ItemCode for ext. search, it’s ok, search works and there is no error.
Our question is: we need to check ItemCode for ext. search.
Simply put the following code in Page_DataRendering server event:$this->ItemCode->Visible = FALSE;
We have sent a test program to support@phpmaker.dev for this issue.