Typeahead Classic drop-down box hint

Source: Internet
Author: User

--------------------JS Interface--------------------------------

Find a company customer
$scope. A = [];
Datacenter.find ("Customer/info", {company:1})
Datacenter.addeventlistener ("Customers", function (e) {
$scope. A = E.data;
$scope. $apply ();
});
if ($ (' #C ')! = null) {
$ (' #C '). Typeahead ({source:
function () {
Return $scope. A
}
});
}

--------------------back-end controller--------------------------------
@RequestMapping (value = "/info", method = Requestmethod.get)
Public Object require (@RequestParam (required = false) Map m) {
Return Dataevent.wrap ("Customers", Customerservice.require (m));
}

Service---Public string[] require (map<string, string> m);

[Email protected]
Public string[] Require (map<string, string> m) {
List List = Customerdao.require (M);
int size = List.size ();
if (size <= 0) {
return new string[]{};
}

ArrayList al = new ArrayList ();
for (int i = 0; i < size; i++) {
Map C = (map) list.get (i);
String cid = c.get ("CID"). ToString ();
String cname = C.get ("cname") = = null? "": C.get ("CNAME"). ToString ();
Al.add (CID + "/" + CNAME); Customer name fuzzy query with no numbering
Al.add (CNAME);
Al.add (cname+ "/" +cid);
Al.add (CID);
}
String[] s = new string[size];
Return (string[]) Al.toarray (s);
}

DAO----//Fetch company user
Public list<map<string, string>> require (map<string, string> m);

--------------------ORM Mapping File--------------------------------

Mapper--<select id= "require" parametertype= "Java.util.Map" resultmap= "Customers" >
SELECT
<include refid= "Columns"/>
From CUSTOMERS
<where>
Company=#{company, jdbctype=numeric} and Black=0
</where>

--------------------HTML5 Part--------------------------------

<div class= "col-md-7 col-sm-7 control-btm Control-label" style= "text-align:left;" >
<input type= "text" class= "Control-btm input-sm form-control" id= "C" value= "" data-provide= "Typeahead" data-items= " "Ng-model=" NameId "ng-blur=" GetName () "/>
<input type= "hidden" class= "id=" CID "ng-model=" CID "/>
</div>

Typeahead Classic drop-down box hint

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.