Skip to content
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

How to allow user input without autocompleting it with suggestion properly? #405

Open
o28o opened this issue May 9, 2023 · 0 comments
Open

Comments

@o28o
Copy link

o28o commented May 9, 2023

Hi there. Thank you so much for your your project.

It does exactly what I need and better then other that I've google for.

Test page https://find.dhamma.gift/vass.html

I use it with datatables 1.10 but I have few little problems

  1. How to set delimiter to " " (space). Now it suggests whole sentences but I need just separate words
    screenshot 1

  2. When user types a word e.g. "appa" and hits enter it automatically pastes the whole 1st sentence "Appamādasutta Diligence" from the suggestions. but user don't need the whole sentence but just users input in this case. How to allow user input in this case?
    screenshot 2

Code that I'm using right now

` 'initComplete': function(){
var api = this.api();

     // Populate a dataset for autocomplete functionality
     api.cells('tr', [0, 1, 2, 3, 4, 6]).every(function(){
                    var data = this.data().replace( /(<([^>]+)>)/ig, '');
        if(dataSrc.indexOf(data) === -1){ dataSrc.push(data); }
     });

     // Initialize Typeahead plug-in
     $('.dataTables_filter input[type="search"]', api.table().container())
        .typeahead({
           source: dataSrc,
           afterSelect: function(value){
              api.search(value).draw();
           }
        }
     );`
@o28o o28o changed the title How to Handle html code in suggestions properly? How to allow user input without autocompleting it with suggestion properly? May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant