jquery-flexdatalist icon indicating copy to clipboard operation
jquery-flexdatalist copied to clipboard

Sample Doubt

Open pafcosta opened this issue 6 years ago • 4 comments

Hi,

I'm trying to use your plugin but in my project, but when i tried to use. it shows like a combo, not like a input text. as your sample.

   <form>
                <div class="form-group">
                    <input type="text"
                           placeholder="Programming language name"
                           class="form-control flexdatalist flexdatalist-set"
                           data-min-length="1"
                           list="languages"
                           name="language">
                </div>
                </form>

        <datalist id="languages">
            <option value="PHP">PHP</option>
            <option value="JavaScript">JavaScript</option>
            <option value="Cobol">Cobol</option>
            <option value="C#">C#</option>
            <option value="C++">C++</option>
            <option value="Java">Java</option>
            <option value="Pascal">Pascal</option>
            <option value="FORTRAN">FORTRAN</option>
            <option value="Lisp">Lisp</option>
            <option value="Swift">Swift</option>
        </datalist>

Can you help me?

Thanks, /Paulo Costa

pafcosta avatar Mar 15 '18 17:03 pafcosta

Do you mean a combo like this: capturar ?

If so, it is normal having that little arrow in the left. Even so, you should still be able to type letters to search in the datalist

jotahws avatar Mar 19 '18 13:03 jotahws

Yes it's. Just asked because in the sample page, this litle doesn't appear and inspecting the code and js, the plugin some how create a input and hide the selectbox.

Meanwhile this can be hide using css trick.

Thanks for your feedback.

pafcosta avatar Mar 19 '18 13:03 pafcosta

To be frank, i personally don't like using <datalist> to add data to flexdatalist...

In my opinion, adding a JSON data via JQuery is much easier and dynamic, for example:

$('#input').flexdatalist({
         searchIn: 'value',
         minLength: '1',
         data: [
            {"value": "php"},
            {"value": "Open"},
            {"value": "Close"}
          ]
});

And if you want to change data along the way (using ajax to search in database for example), you can do it by using the method $.flexdatalist('data', 'My new data')

Besides, if you use it like that, the little arrow will no longer appear, because it is not a <datalist> anymore.

Best Regards, João

jotahws avatar Mar 19 '18 16:03 jotahws

Hi,

Yeah, flexdatalist started from the <datalist> (basic, browser specific autocomplete) implementation in mind, but something more flexible (sorry), UI and data wise.

I try to give it as much events available as possible so that anyone can customize the behavior as they like.

Also being careful about features that are requested to implement, because, otherwise starts to become a autocomplete input text field that wants to be a select box, being bloated and so on. As I think you know, if you set minLength to 0, it should show all options available, almost like a select, which might already be too much for what flexdatalist tries to be. :)

Cheers!

sergiodlopes avatar Mar 24 '18 19:03 sergiodlopes