-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deform2: AutocompleteInputWidget - more powerful configuration for typeahead.js #185
Conversation
This parameter provides an alternative, more powerful (though hairy) means of configuring typeahead.js, providing access to the complete feature set of the plugin.
I'm going to need to understand this a little better but the type-ahead.com site is down at the moment, so deferring. |
The main issue is that for certain useful configurations of typeahead.js one needs to be able to put literal javascript (other than strings and numbers) into the configuration parameter. For an example, see the last demo at http://twitter.github.io/typeahead.js/examples/, which, to support templating of the completion items, requires something like:
The patches in this pull request support that configuration via something like:
The I haven't thought about it too hard, but something like this could also probably be used to support hairy configurations for select2 and TinyMCE as well. |
The canonical way to do this in HTML 5. AFAIK this can be made to work with a JSON source. |
@Themanwithoutaplan Could you elaborate a bit? It's probably that I'm dense, but I'm having trouble making sense of your comment. |
@Themanwithoutaplan the implementation of Meanwhile a typeahead is useful. For a demo of a recent version of typeahead, see https://selectree.calpoly.edu/ |
@dairiki this can be done natively by the browser using the @stevepiercy that's a nice widget. Be even nicer if it worked with the |
@Themanwithoutaplan if by "pretty good" you mean "buggy", then I agree. 😉 Did you see the footnotes for datalist on caniuse? Those are pretty bad. |
For deform_bootstrap the PR should be merged but I think a more generic |
@Themanwithoutaplan do you mean this branch
I agree with this. Would you create new, separate issue with details? |
As @stevepiercy mentions, typeahead has many more capabilities than (by my understanding, at least) HTML5/datalist: (even if browser support were not an issue) — things like callback/query based completion lists, fancy templatable completion listings. This PR has to do with introducing a mechanism whereby these advanced features of typeahead may be configured through the deform widget. Stock deform has no trouble using typeahead with static completion lists and default completion formatting. In the context of this PR, whether or not HTML5 should be used for simple autocompleting inputs is a red herring. |
@tseaver Reason for closing? |
@dairiki I've added this to the Deform 3.0.0 milestone. I'm preparing a release, now that I have PyPI maintainer access. Would you please be so kind to reopen this PR against |
@stevepiercy I do not see a github UI option to re-open this PR. (Perhaps that is because I am not the one who closed it? — that was @tseaver.) I will work on rebasing over the next couple of days. I guess I can just open a new PR if we can't figure out how to re-open this one... PS: I am no longer using deform in an active project, but I am certainly willing to help get these old PRs merged if they are still pertinent. |
@dairiki yeah, there is no option to reopen a PR against a deleted branch, specifically I would be grateful for you opening the PR, and we can take it from there. I recently discovered that when someone opens a PR against a repo where I have write access, I can push commits to that person's branch in their repo and it updates the PR. |
I've rebased my typeahead-datasets branch onto the current master. Unfortunately, there is an issue. I had been relying on a hack to support JSON-esque serialization of values containing literal javascript using I see two ways forward:
I’m not sure that either is worth the effort. Thoughts/Ideas? (Questions?) |
Would you please create a new PR with your new branch against Also do you have a link to your hack via |
Also we will support only Python 3.5+ going forward. Does this thread describe the same issue https://stackoverflow.com/a/53848267/2214933? Does |
@stevepiercy New PR draft created: #413 My hacked up version of |
This adds a
datasets
parameter toAutocompleteInputWidget
which can be used as an alternatives to thevalues
parameter for configuring the typeahead.js plugin.Basically the value of
datasets
(if given) is JSONified and passed directly to the typeahead plugin. In addition,a custom JSONifier is used. The JSONifier respects a
literal_js
marker class that can be used to includehunks of literal javascript within the
datasets
parameter.(A patch to deformdemo with a demo is forthcoming.)