Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>i will show my code for the autcomplete using jQuery UI pluggin, which i used.</p> <p>please follow the below code,</p> <pre><code>$("#fileNameInput").autocomplete({ source : function(request,response){ var url = "autocomplete?type=FileSearch&amp;time="+new Date(); // some URL mapped to servlet $.post(url, { /* 'srcIdX' is the extra data i pass, this is send along with 'term', so at servlet i do request.getParamter('term') and request.getParamter('sourceid') */ sourceid : $("#srcIdX").val() }, function(data){ /* here my data which i get from server (i.e. from servlet in response) is as follows { "data" : [ { "fileName" : "something", "fileId" : "something", }, { "fileName" : "something", "fileId" : "something", },...... ] } */ var jsonObj = $.parseJSON(data); if(jsonObj.data != "null"){ response($.map(jsonObj.data,function(obj,i){ return { label : obj.fileName, value : obj.fileName } })) } } ); }, minLength : 1, open: function() { $(this).removeClass("ui-corner-all").addClass("ui-corner-top"); }, select: function(event, ui){ $("#fileIdX").val(ui.item.value); // THIS IS SOME INPUT HIDDEN WHICH I USE TO STORE THE 'VALUE' OF SELECTED 'LABEL' } }); </code></pre> <p>at server side i can pass the jSon using GSON library, or simply using a string buffer,</p> <pre><code>PrintWriter out = response.getWriter(); StringBuffer strb = new StringBuffer(); strb.append("{ \"data\" : [ { \"fileId\" : \"12\", \"fileName\" : \"Rahul_source\" },"); strb.append(" { \"fileId\" : \"13\", \"fileName\" : \"doug_source\" }, "); strb.append(" { \"fileId\" : \"14\", \"fileName\" : \"sridhar_source\" }, "); strb.append(" { \"fileId\" : \"15\", \"fileName\" : \"FRT\" }, "); strb.append(" { \"fileId\" : \"16\", \"fileName\" : \"ASWQ_source\" } "); strb.append("] } "); out.write(strb.toString()); </code></pre> <p>trying this simple approach will work</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload