GithubHelp home page GithubHelp logo

auraq / autocompleteformendix Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 31.0 33.03 MB

An autocomplete widget for mendix

License: Apache License 2.0

JavaScript 20.23% HTML 3.03% CSS 0.01% Java 0.17% SCSS 76.56%

autocompleteformendix's People

Contributors

andries-smit avatar da-dude avatar lindski avatar mgroeneweg avatar nvwieren avatar old-profile avatar pranaykondai avatar pratleymatthew avatar tieniber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

autocompleteformendix's Issues

Need to cancel new object page twice first time I enter the page

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

isCurrency is removed in mendix 8

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

callback structure unclear

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();
}

Feature request: Render select page button next to text input

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:

autocomplete_select1

The result looks like this:
autocomplete_select2

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.

Deprecated JS functions

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.

JavaScript errors when running widget

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

Floating inputbox

Very happy with the widget. Only sometimes the input box floats higher on the screen, instead where it should be?

Sort of Result doesn't work on 7.11

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.

Add Enum support to templated results

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

Auto add non found record to entity

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:

  • Automatic add the string to the linked entity
  • Add the value to another field'

Jan de Lange ( [email protected] )

Apply is not a fuction - Mendix 7.14.1

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.

On change of association in background doesn't trigger refresh for widget

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.

TypeError: $.throttle is not a function

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?

Mx 7.21.0 - 'GetGuid' error when refreshing in client in on change microflow

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.

image

Search Xpath constrained by (context) does not work

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.

Request: Microflow options for On Change events

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?

Request: Add Search delay

The widget is highly appreciated!

It would be great if a search delay (in milliseconds) can be added before the search is executed.

Previous search results overwrite last search results

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.

autocompleteformendix

Mx 8.3 - Client Warning, mx.ui.action depreceated, use mx.data.action instead

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

Association isn't Set

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?

using widget on master-detail page

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?

Mendix 7.2.0 - search method undefined

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.

Non Editable state is not supported

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

Auto open

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:

  • create record ( i did that with an hotkey )
  • the page opens and get focus on the autocompleteformendix witget
  • the customer should check the record ( sometimes a date should be modified )
  • Save and Print ( is also one hotkey )
    So everything is done with the keyboard except opening of the autocompleteformendix witget

Exception thrown first time execution

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)

Maintained?

@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

Add DateTime support to templated results

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

Validation error not passed to tabcontainer badge

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!

Tabbing from an autocomplete widget while in search mode results in loss of focus

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.

Widget does not work on iOS

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.

Request: add constrained by possibility

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.

GetGuid error

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);

Widget does not work on Mendix 7.20.1

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?

Feature request: Make the widget role/security aware to set it read-only or editable

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.

JS error when running the app as e.g. iPhone, Galaxy or Responsive (Chrome / F12)

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

Update of jquery library

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

Request: Add Microflow as datasoruce

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.

image

Also, I noticed that the OnChange event is firing twice when there are multiple AutoComplete widgets.

Any help on this would be greatly appreciated.

AutoCompleteForMendix in combination with close page

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).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.