ExtJS dropdown box, multiple selection, single selection, dynamic transfer value

Source: Internet
Author: User

Background Java code

@RequestMapping (params = "Command=adduser")
public void GetUser (HttpServletResponse response) throws exception{
Jsonobject result1 = new Jsonobject ();
Jsonarray rows1 = new Jsonarray ();
String search = "1=1";
list<inducedcause> list = inducedcauseservice.getinducedcauselist (search);
Jsonobject UX = NULL;
for (Inducedcause uc:list) {
ux= new Jsonobject ();
Ux.put ("id", Uc.getid ());
Ux.put ("Reason", Uc.getreason ());
Rows1.put (UX);
}
Result1.put ("Results1", rows1);
Result.put ("TotalCount", List.size ());
Response.getwriter (). Write (result1.tostring ());
}

Front desk ExtJS Code

var comstore1 = new Ext.data.Store (
{proxy:new Ext.data.HttpProxy ({url: ' ${pagecontext.request.contextpath}/treatmentrecord/treatmentrecord.page? Command=adduser '}),
Read JSON
Reader:new Ext.data.JsonReader ({
Root: ' Results1 ',
Remotesort:true,
Fields: [' id ', ' Reason ']})
});

{
Xtype: ' Lovcombo ',
Fieldlabel: ' Inducing cause ',
ID: ' Inducedcause-id ',
Name: ' Inducedcause ',
Displayfield: ' Reason ',
Valuefield: ' id ',
Hiddenname: ' id ',
Mode: ' Local ',
Editable:false,
Loadingtext: ' Loading ... ',
Store:comstore1,
Value: ' <%=realname%> ',
Emptytext: ' Please choose the reason ',
TriggerAction: ' All ',
MAXLENGTH:100,
Multiselect:true,
Anchor: ' 100% '
},

To implement a multi-select drop-down box to introduce two JS class libraries

<link rel= "stylesheet" type= "Text/css" href= "${pagecontext.request.contextpath}/ext/examples/ux/css/ Ext.ux.form.LovCombo.css"/>
<script type= "Text/javascript" src= "${pagecontext.request.contextpath}/ext/examples/ux/ EXT.UX.FORM.LOVCOMBO.JS "></script>

Otherwise, the single-selection drop-down box, the data is dynamic

Beginner ExtJS, hoping to help people in need

ExtJS dropdown box, multiple selection, single selection, dynamic transfer value

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.