auraq / autocompleteformendix Goto Github PK
View Code? Open in Web Editor NEWAn autocomplete widget for mendix
License: Apache License 2.0
An autocomplete widget for mendix
License: Apache License 2.0
Recently converted a project to 7.10. The widget is non responsive when it is used on popup pages in 7.10 - worked fine in 7.9. If I change the page template to responsive (top bar), the widget works fine again.
Hi Iain,
When I directly click the Cancel button after entering the No Results page to add the object the page becomes uneditable. In the test project I send earlier AND the one you updated, I need to click a second time to cancel the page. When I first save the object and return a second time this does not happen.
This only happens when opening the page in combination with the AC widget. When I open the page from a button the cancel button works fine. Not critical but hope you can help.
Cheers,
Frans
the isCurrency
method of MxMetaObject has been removed in mendix 8, meaning this widget crashes due to line 867 of AutoCompleteForMendix.js
According to release notes, functions deprecated in Mx 7 were removed in v3.0.
I suggest to remove all uses of isCurrency
Debugging the widget JavaScript code I found some callback structures that were unclear to me (and possible incorrect).
Am i correct in assuming that in the _loadCurrentValue function the callback is called twice?
Once here:
if(referencedObjectGuid !== null && referencedObjectGuid !== "") {
mx.data.get({
guid: referencedObjectGuid,
callback: dojoLang.hitch(this, function(obj){
this._processResults([obj],this._formatCurrentValue, callback);
})
});
} else{
if (callback && typeof callback === "function") {
callback();
}
};
and once here:
// Execute callback.
if (typeof callback !== 'undefined') {
callback();
}
It would be great if it were possible to optionally enable a select button to be rendered next to the control. In some cases, it might be difficult to search in a text box alone as it might be necessary to filter down in order to find an object. I solved this at the moment by putting a standard reference selector next to the auto complete widget, setting it to select by page and disabling everything but the button itself using CSS:
Clicking the select button will open a select page to set the reference instead. Creating the form like this is totally workable but it would be very cool if the widget had an option to render a select button next to it by default.
This widget uses a range of JS functions that will be discontinued in Mendix 7 which is due to release shortly. To support Mendix 7 and later, some JS will need to be changed:
mxui.js?636162850359943084:5 Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.f.getText @ mxui.js?636162850359943084:5
mxui.js?636162850359943084:48 DEPRECATED: mxui.dom.{tagName} will be removed in version 7.0. Use mxui.dom.create API for creating elements.d @ mxui.js?636162850359943084:48
mxui.js?636162850359943084:48 DEPRECATED: mxui.dom.builder.create will be removed in version 7.0. Use mxui.dom.create instead.d @ mxui.js?636162850359943084:48
mxui.js?636162850359943084:48 DEPRECATED: mxui.dom.{tagName} will be removed in version 7.0. Use mxui.dom.create API for creating elements.d @ mxui.js?636162850359943084:48
mxui.js?636162850359943084:48 DEPRECATED: mxui.dom.builder.create will be removed in version 7.0. Use mxui.dom.create instead.
If a template is created that uses attributes over an association, the values of these attributes are not rendered and the token is displayed instead
Hi, thanks for the great widget. Highly appreciated. I have some remaining issues to be able to fully use it though. I have one issue that is reproducible with attached project: That is that on a NoResult I open a page to edit the object I want to create. When I Cancel that page, enter a new searchstring and click the No Results Found button nothing happens and I see the following error in the console:
Uncaught Error: Validate values using validator#validate(value, attr) before calling MxObject#set.
at Object.set (mxui.js?636295085723576207:10)
at HTMLAnchorElement.onclick (AutoCompleteForMendix.js:286)
When I first save the object, enter a searchstring and click the No Results Found button it does work.
In the console I also notice the following error which happens regularly:
Uncaught TypeError: ((jQuery.event.special[handleObj.origType] || (intermediate value)).handle || handleObj.handler).apply is not a function
at HTMLDocument.dispatch (jquery-1.11.2.js:4665)
at HTMLDocument.elemData.handle (jquery-1.11.2.js:4333)
I have a hunch that this is a cause for another issue which I cannot yet reproduce in this project but can in my actual project. In that case I need click the save on the new object page twice to actually save and close the page.
Hope you can help.
Frans
TestAutoComplete.zip
Very happy with the widget. Only sometimes the input box floats higher on the screen, instead where it should be?
I use the autocomplete widget a lot and the optionslist is not sorting anymore.
I'm running 7.11
For now I have started using MF and sort the list, when it's urgent. But would prefer that the option wroks again.
After fixing the issue related to mx.data.unsunscribe(handle), I am getting this new error: Error while applying context TypeError: this is undefined e.exports.applyContext/ . Please advice how to fix this.
When nested within a list view, the on change event is triggered anywhere from 3-16 times on a single change.
Mendix version 7.8
Result template currently does not support the selection of Enum attributes
Add support for this data type that, when selected, will display the caption of the item
First, I like this widget very much.
When a record not is found, the "no results found text" will appear. We are looking for a function where not a text is shown, but a small button with the possibility to start a Microflow. With that MF you can add functionality yourself like:
Jan de Lange ( [email protected] )
I get the following error in the modeler's console
((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply is not a function TypeError: ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply is not a function
at HTMLDocument.dispatch (http://localhost:9080/widgets/AutoCompleteForMendix/lib/jquery-1.11.2.js?636626671628180558:4665:9)
at HTMLDocument.elemData.handle (http://localhost:9080/widgets/AutoCompleteForMendix/lib/jquery-1.11.2.js?636626671628180558:4333:28)
Widget works fine everywhere but iOS devices.
First off, thanks for this great widget!
It seems that if I have an association which is empty (say: PurchaseOrder_Country), whenever an On change microflow is triggered from another random field, which populates the PurchaseOrder_Country association (change object, refresh = yes), this change is not reflected in the widget. I have double checked this with the default reference selector and see that this one is properly updated, whereas the contents of the widget remains empty.
I am using the latest Auto Complete widget in our project (v 3.2.0).
I have configured an on change microflow. Everything seems to work correctly, but everytime before the on change mciroflow is called I can see an error in the browser console:
Uncaught TypeError: $.throttle is not a function
I looked up the javascript line that caused the error from the debugger:
$.throttle( 50,self._execMf(self._contextObj.getGuid(), self.onChangeMicroflow));
If I set a breakpoint I can indeed see that throttle is undefined. Still the microflow is called and everything runs fine, except that the browser console shows an error.
Am I missing some configuration/dependencies?
I'm running into a refresh/update problem when trying to refresh in client in an on change microflow. The on change is located on multiple AutoComplete widgets on a single page. All of these widgets are populated by a non-persistent entity and we've tried either populating the selectable options by microflow as well as by the cached microflow. Both times the error occurred. The second widget's selectable objects depend on the object chosen in the first, and so on for the other widgets on the page. When removing the on change microflow from the widget or removing the refresh in client action of that microflow, the error doesn't occur anymore. This is the full error seen in the modeler:
"Cannot read property 'getGuid' of null TypeError: Cannot read property 'getGuid' of null
at http://localhost:8080/widgets/AutoCompleteForMendix/widget/AutoCompleteForMendix.js?636885916585373427:725:56
at Object.forEach (http://localhost:8080/mxclientsystem/mxui/mxui.js?636885916585373427:5:30397)
at E.(anonymous function).O._processResults (http://localhost:8080/widgets/AutoCompleteForMendix/widget/AutoCompleteForMendix.js?636885916585373427:722:23)
at E.(anonymous function).O. (http://localhost:8080/widgets/AutoCompleteForMendix/widget/AutoCompleteForMendix.js?636885916585373427:471:30)
at http://localhost:8080/mxclientsystem/mxui/mxui.js?636885916585373427:5:26632
at S (http://localhost:8080/mxclientsystem/mxui/mxui.js?636885916585373427:67:88645)
at http://localhost:8080/mxclientsystem/mxui/mxui.js?636885916585373427:67:95088"
Also, this error doesn't occur every single time a refresh in client is executed, sometimes it does work.
When looking into the issue, it appears the problem comes from the _updateCurrentSelection function where it tries to retrieve the selected non-persistent referenced object, but returns a null value. See below for a screenshot of the code I refer to.
Search Xpath constrained by (context) does not work.
The Xpath constrained by (context) does not constraint the number of objects.
The context object is not yet committed.
Notice: When using a normal reference selector the constrained by (1 path) work fine.
I have an on-change microflow that can take some time to execute - I'm looking for the microflow options menu available on native mendix functionality where you can control blocking progress spinners and loading messages. Any chance this is in the works?
The widget is highly appreciated!
It would be great if a search delay (in milliseconds) can be added before the search is executed.
Hi,
Thanks for making this widget, we've started using it but found an issue which I will try to describe below:
I’ve noticed that if you start typing to search and the minimum number of characters before the search is executed is entered, the widget will start searching.
But when typing some more characters a new search action is triggered, this search action is completed earlier then the first search action.
The result on screen is that you first see the results of the second search action, but these results will be overwritten by the first search action (see the attached screenshot). So the results don’t match the input characters anymore.
I also added a screenshot which shows the result of the behavior described above.
Hi there
When using V5.0 of this widget, in Mendix 8.3, it logs a client level warning every time a search runs
"DEPRECATED: mx.ui.action. Use mx.data.action directly instead. -- will be removed in version: 10.0"
Doesn't look like it's causing any issues, but less warning in the log is always nice if it's an easy fix
Cheers
I use the autocomplete for searching data. In the search, a webservice is called and a list is being retrieved with all the data. However, when selecting the correct object, association aren't always set correctly.
In a different test project, i have the same issue.
This has worked in previous versions in Mendix 6.10.10, however in 7.23.6 it didn't. Can you look at it, for fixing that the association is alway set correctly?
I'm having issues implementing this widget on a master-detail page (the widget being used in the detail part of the page). With the widget on the page the page doesn't load, only displays the loader, without the widget it load without any problems.
I'm not sure where to look for the solution, could this be a known issue with the widget or a problem with mendix?
Are you kidding me?
This line of code did kill the startup of an app in latest build of PhoneGap.
https://github.com/AuraQ/AutoCompleteForMendix/blob/master/src/AutoCompleteForMendix/lib/jqwrapper.js#L2
The async behaviour is not guaranteed to back in time and set it again, causing lots of errors and wasting much my time.
Sorry to so blunt, hope you fix it.
Cheers, Andries
For example if I want to search on integer or long then this attribute is not supported by the widget. Please can you update this widget to support search on all data types?
Many thanks,
Mohammed Siddiqui
I'm using the latest version of the widget, with Mendix modeler version 7.2.0.
I have this error when using the widget:
com.mendix.core.CoreRuntimeException: Exception occurred in action '{"xpath":"//MyFirstModule.MyEntity[undefined(undefined,'trr')]","amount":-1,"offset":0,"returnsCount":false,"sort":[{"memberName":"FullName","direction":{}}],"type":"RetrieveXPathSchemaRawAction"}', all database changes executed by this action were rolled back
at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.processErrorState(CoreActionHandlerImpl.scala:152)
I tried with both search methods "starts with" and "contains".
The search is an XPath search.
We widgets does not have a non editabale state. I often open a screen and give the user the choice to edit. So I open readonly. I try to use one page for both read and edit mode. Saves maintenacce and development time
Validation messages that appear under the dropdown are not cleared when the attribute changes.
An option which opens the dropdown list directly, so the user can start typing without any mouse click.
I have a situation where speed is important The customer has to do four things:
the first time the _loadCurrentValue is executed, it seems that the _contextObj is still null. From what i can see, the _contextObj is only given a value when the update function is called.
Because this value is null, an exception is thrown (and swallowed by the mendix code) on this line:
var referencedObjectGuid = this._contextObj.get(this._reference)
@AuraQLimited @lindski
Is this project still maintained?
Seems there has been no activity since Dec 2018 and PR #50 is still outstanding despite being blocking for Mx 8.
We are using this widget in production and would just like to know whether we should consider dropping it.
Thanks
Result template currently does not support the selection of DateTime attributes
Add support for this data type that, when selected, will display the item, formatted using a user supplied pattern
I've noticed that if you have the widget in a tabcontainer (or multiple instances), and a Show validation message is triggered, these validation errors are not added to the tabcontainer level which displays the number of validation errors in a badge.
So instead of showing a badge with the number 3, right now the value 1 is displayed if I have three fields, of which 2 are the AutoComplete widget.
Any chance you could have a look at this?
Thanks in advance!
When you are in search mode and you press tab you completely loose focus. I tracked down the issue to a known issue of select2 4384. The best result i got so far is that when pressing tab the focus will shift to the select span and from there you are able to continue the normal tab route, but this would still require users to press tab twice in order to jump to the following Mendix widget. Did you have a go at this and if not could you look into this.
During testing for implementing this widget into our project we realized that the widget will not work on iPhone. Responsive and Android both work as expected, but on iOS the widget will not respond when tabbed on, preventing the search bar to fold open to enable text input. Test was executed using the Mendix Developer App. Please advise if this will be addressed in the near future. Thank you.
Hi,
I don't know how much work it would be, but currently you have the possibility to add an XPath constraint, which is already great!
However, sometimes you want to use a Constrained by (as seen on the default Mendix reference selector) functionality which has the bonus of being able to apply constraints with changes in memory.
My use case is the following:
Project 1 <-- * Subproject 1 <-- * Activity
What I would like to achieve is that if a Project is selected, the selector for Subproject gets constrained, without having to do a commit first (as that could be handled with the XPath constraint).
Of course, you could use default Mendix functionality, but what I'm looking for is exactly the functionality this widget already offers.
Context: I'm running the widget in a non-persistent entity (list view) and it referrs to a persistent entity.
The following error occurs:
autoCompleteForMendix1: Error while applying context Error: Trying to unsubscribe using an invalid subscription handle
Fails after 1 level.
I have implemented this widget in my project with a relation and xpath search. The users that is logged in can only select the source record when it is linked to him (constraint on database level > xpath constraint). When the record can not be retrieved an error popsup in the widget. The errors occurs from line 424 till 427. See
if(referencedObjectGuid !== null && referencedObjectGuid !== "") {
mx.data.get({
guid: referencedObjectGuid,
callback: dojoLang.hitch(this, function(obj){
this._processResults([obj],this._formatCurrentValue, null);
Hi, the widget (version 3.1) does not work on Mendix 7.20.1, it is showing the below error on the console log:
TypeError: Cannot read property 'getGuid' of null
at VM2007 AutoCompleteForMendix.js:681
at Object.forEach (VM1927 mxui.js:5)
at Object._processResults (VM2007 AutoCompleteForMendix.js:678)
at Object.<anonymous> (VM2007 AutoCompleteForMendix.js:427)
at VM1927 mxui.js:5
at S (VM1927 mxui.js:82)
at VM1927 mxui.js:82
Any suggestions?
Hi there. Is it much work to make the widget behave like other Mendix widgets and act on the security settings to make the widget read-only or editable, based on the role security settings in the entity/attribute. I believe in other Mendix widgets this is called Editability Default:
Default (default) The value is editable if security allows it (as in, if the user that is signed in has write access to the selected attribute).
This would really help us in our project.
If this would be possible/viable then we would, of course be willing to contribute to the solution.
Thanks and regards,
Gerrit van Kammen
btw I read that you have worked together with Phil Waterhouse (Springer Healthcare) on the SMART app. Phil is a colleague of mine, although we have never worked together on a project.
Hi Iain,
The following error only occurs regularly when running the app as e.g. iPhone, Galaxy or Responsive (Chrome / F12):
Uncaught TypeError: ((jQuery.event.special[handleObj.origType] || (intermediate value)).handle || handleObj.handler).apply is not a function
at HTMLDocument.dispatch (jquery-1.11.2.js:4665)
at HTMLDocument.elemData.handle (jquery-1.11.2.js:4333)
You can use the project I send you before and you modified to reproduce.
Thanks,
Frans
Hi there,
The widget is using quite an old library of jQuery containing several severe invulnerabilities. Can you please update this library to the newest library?
Kind regards,
Wouter
Attributes of type Integer, Long, Decimal, AutoNumber are not rendering in the dropdown of results.
Hello,
Thanks for the great widget. I was wondering if it is possible to add Microflow as a data source to this widget.
Currently, the widget lets you constrain the data using 'xpath' and 'constrained by' but we cannot use them to filter data based on variables.
Below is an example of my use case:
I have a "CourseLookup" entity with attributes role type and associations to ScheduledCourse and LocationLookup. When a user wants to add a course, I want to filter the CourseLookup data based on the user role (user.UserRole=CourseLookup.RoleType), DateEnrolled (Course.DateEnrolled < ScheduledCourse.EndDate) and the state (User.State = LocationLookup.State) to which the user belongs.
Also, I noticed that the OnChange event is firing twice when there are multiple AutoComplete widgets.
Any help on this would be greatly appreciated.
Hello,
Whilst running in IE v11.706.1734.0 Mendix v7.16.0 we are getting a no constructor found error.
More details can be found here:
https://support.mendix.com/hc/requests/82970
As this is a community managed widget I hope this is the correct place for raising the bug. If it isn't please let me know where so I can get this logged.
Regards
Adrian
I have defined a "On change event" on the widget. On that event a microflow is called which closes the current page, does some processing and opens a new page. With the newest version (6.0.0) the new page is closed instead of the current page (page that holds the widget).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.